private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (storeData) { StudentInfoStorage.WriteXml <ObservableCollection <Student> >(students, "StudentsInfo.xml"); } }
private ObservableCollection <Student> GenerateStudents(int cnt) { //for (int i = 0; i < cnt; i++) //{ // students.Add(new Student { îd = i, FirstName = "firstname" + i, lastName = $"LName"+i, hobbies = "hobbies" }); //}rnd.Next(female.Count) var lstInput = StudentInfoStorage.ReadXml <List <InputName> >("StudentsName.xml"); male = (from n in lstInput where n.cat == "m" select n).ToList(); female = (from n in lstInput where n.cat == "f" select n).ToList(); var lst = new ObservableCollection <Student>(); for (int i = 0; i < 5; i++) { lst.Add(new Student { îd = i, FirstName = female[i].name, lastName = $"lName{i}", hobbies = "the hobbies" }); } return(lst); }