Exemplo n.º 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();
        }
Exemplo n.º 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);
        }