/// <summary> /// Вход в программу /// </summary> public static void Main(string[] args) { while (true) { Console.WriteLine("Creating two lists:"); Console.WriteLine(); PersonList list1 = RandomPerson.GetRandomPersonList(3); PersonList list2 = RandomPerson.GetRandomPersonList(3); Print("list1", list1); Print("list2", list2); PressAnyKey(); Console.WriteLine("Add a new person to the first list."); Console.WriteLine(); list1.Add(InputPerson()); Console.WriteLine("Copy the second person from the " + "first list to the end of the second list."); Console.WriteLine(); list2.Add(list1[1]); Print("list1", list1); Print("list2", list2); PressAnyKey(); Console.WriteLine("Removing the second person from the first list."); Console.WriteLine(); list1.Delete(1); Print("list1", list1); Print("list2", list2); PressAnyKey(); Console.WriteLine("Removing the second list."); Console.WriteLine(); list2.AllDelete(); Print("list1", list1); Print("list2", list2); if (QuitOfProgram()) { return; } } }
public void Delete() { PersonList personList = GetPersonList(); personList.Delete(this); }