static void Display(Listard list) { for (int i = 0; i < list.Count; i++) { Console.WriteLine(list.Get(i).FirstName + ' ' + list.Get(i).LastName); } }
static void Main(string[] args) { List <Person> personList = new List <Person>(); Console.Title = "Person No OO"; Console.WriteLine("\n******* " + Console.Title + " ********"); personList = Load(); if (personList.Count == 0) { Person person = new Person("Alma", "Iller", "0179 987654321"); personList.Add(person); Person person2 = new Person("Hugo", "Heller", "+49 (0)221 123456"); personList.Add(person2); } Listard list = new Listard(); foreach (Person p in personList) { list.Add(new Person(p.FirstName, p.LastName, p.PhoneNumber)); } Console.WriteLine("Lastname asc:"); list.Sort(); Display(list); Console.WriteLine("\nLastname desc:"); list.Sort(false, false); Display(list); Console.WriteLine("\nFirstname asc:"); list.Sort(true); Display(list); Console.WriteLine("\nFirstname desc:"); list.Sort(true, false); Display(list); // Display(personList); Store(personList); Console.Write("\nFertig. "); Console.ReadLine(); }