public static void ExampleSerizalization() { TextWriter writer = new StreamWriter(path); XmlUser user = new XmlUser() { name = "Sergii", lastName = "ZhuravSkyi" }; serializer.Serialize(writer, user); writer.Close(); }
public static void ExampleDesirializaton() { string readText = File.ReadAllText(path); Console.WriteLine(readText); FileStream fs = new FileStream(path, FileMode.Open); XmlUser user = (XmlUser)serializer.Deserialize(fs); Console.WriteLine(user.lastName); }