示例#1
0
        public static void ExampleSerizalization()
        {
            TextWriter writer = new StreamWriter(path);
            XmlUser    user   = new XmlUser()
            {
                name = "Sergii", lastName = "ZhuravSkyi"
            };

            serializer.Serialize(writer, user);
            writer.Close();
        }
示例#2
0
        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);
        }