This sample used to common function for all type object serialization and deserialization.
using System.Runtime.Serialization.Formatters.Binary; using System.Xml.Serialization; namespace Framework { public static class IGUtilities { public static string Serialization(this T obj) { string data = JsonConvert.SerializeObject(obj); return data; } public static T Deserialization(this string JsonData) { T copy = JsonConvert.DeserializeObject(JsonData); return copy; } public static T Clone(this T obj) { string data = JsonConvert.SerializeObject(obj); T copy = JsonConvert.DeserializeObject(data); return copy; } } }