Esempio n. 1
0
        public void ser(ListOfMarks listOfMarks)
        {
            FileStream    fs  = new FileStream(@"D:\Desktop\PP2\marks.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite);
            XmlSerializer xml = new XmlSerializer(typeof(ListOfMarks));

            xml.Serialize(fs, listOfMarks);
            fs.Close();
        }
Esempio n. 2
0
        public static void f1()
        {
            Mark        s1   = new Mark(100);
            Mark        s2   = new Mark(89);
            Mark        s3   = new Mark(80);
            ListOfMarks list = new ListOfMarks();

            list.ListOfmarks.Add(s1);
            list.ListOfmarks.Add(s2);
            list.ListOfmarks.Add(s3);
            list.ser(list);
        }
Esempio n. 3
0
        public static void deser()
        {
            FileStream    fs   = new FileStream(@"D:\Desktop\PP2\marks.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite);
            XmlSerializer xs   = new XmlSerializer(typeof(ListOfMarks));
            ListOfMarks   list = xs.Deserialize(fs) as ListOfMarks;

            fs.Close();
            foreach (Mark m in list.ListOfmarks)
            {
                Console.WriteLine(m);
            }
        }