private static void DataContractSerizalizerHelperTest() { Customer customer = new Customer { Id = 1, FirstName = "John", LastName = "Smith", Salary = 1000, DateOfBirth = DateTime.Parse("1980-01-30"), IsRemoved = true }; string xml = DataContractSerizalizerHelper.Serialize(customer); Console.WriteLine(xml); Customer deserializedCustomer = DataContractSerizalizerHelper.Deserialize <Customer>(xml); if (object.ReferenceEquals(customer, deserializedCustomer)) { Console.WriteLine("the same"); } else { Console.WriteLine("another"); } }
public static T Deserialize <T>(this string xml) where T : new() { return(DataContractSerizalizerHelper.Deserialize <T>(xml)); }
public static string Serialize <T>(this T o) { return(DataContractSerizalizerHelper.Serialize <T>(o)); }