private static void ShowAdd() { var collec1 = new PersonsCollection <Person>(lstPers); collec1.Added(new Person("test", "test", 2)); collec1.Reset(); foreach (var element in collec1) { Console.WriteLine(element.Name + " " + element.Surname + " " + element.Age); } }
private static void DeletePerson() { var collec = new PersonsCollection <Person>(lstPers); var pers = collec.FirstOrDefault(person => person.Age <= 10); if (pers != null) { collec.Removed(pers); } collec.Reset(); foreach (var element in collec) { Console.WriteLine(element.Name + " " + element.Surname + " " + element.Age); } }