public static void Ser() { List <Student> Journal = new List <Student>(); Marks m1 = new Marks("100"); Marks m2 = new Marks("70"); Marks m3 = new Marks("50"); m1.ToLetter(); m2.ToLetter(); m3.ToLetter(); Student s1 = new Student("ABC", "10", m1); Student s2 = new Student("DEF", "20", m2); Student s3 = new Student("HIG", "30", m3); Journal.Add(s1); Journal.Add(s2); Journal.Add(s3); XmlSerializer XS = new XmlSerializer(typeof(List <Student>)); FileStream FS = new FileStream("C:/Users/Асер/Desktop/PP2/Midterm/1.xml", FileMode.Create, FileAccess.Write); XS.Serialize(FS, Journal); FS.Close(); }
public Student(string name, string age, Marks mark) { this.name = name; this.age = age; this.mark = mark; }