예제 #1
0
        public Classs Deserialize()
        {
            FileStream    fs     = new FileStream("file.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite);
            XmlSerializer xs     = new XmlSerializer(typeof(Classs));
            Classs        class2 = xs.Deserialize(fs) as Classs;

            fs.Close();
            return(class2);
        }
예제 #2
0
        static void Main(string[] args)
        {
            Classs  class1 = new Classs("PP2");
            Student st1    = new Student("Madina", "Almanova");
            Student st2    = new Student("aaa", "bbb");

            class1.Add(st1);
            class1.Add(st2);
            class1.Serialize();
            Classs class2 = class1.Deserialize();

            class2.Print();
            Console.ReadKey();
        }