private static void PrintPersons(PersonRegister personRegister)
 {
     foreach (Person p in personRegister.Persons)
     {
         System.Console.WriteLine("{0} {1}", p.Surname, p.Firstname);
     }
 }
        static void Main(string[] args)
        {
            Person firstPerson = new Person("Hans", "Muster");
            Person secondPerson = new Person("Max", "Meier");
            Person thirdPerson = new Person("Anna", "Müller");
            Console.WriteLine("My first C# Program: {0}",
                Assembly.GetExecutingAssembly().GetName().Version);
            var personRegister = new PersonRegister();
            personRegister[0] = firstPerson;
            personRegister[1] = secondPerson;
            personRegister[1] = thirdPerson;

            //personRegister.LogToConsole(Person...);

            //console.writeline("person: {0} {1}",
            //    personregister[0].firstname,
            //    personregister[0].surname);
            personRegister.Sort(CompareByFirstname);
            PrintPersons(personRegister);
            //personRegister.Sort(CompareBySurname);

            var personToFind = "Hans";

            var me = personRegister.FindPerson(delegate (Person p)
            {
                return p.FirstName == personToFind;
            });

            Console.WriteLine(me.FirstName);
            Console.ReadKey();
        }
        static void Main()
        {
            Console.WriteLine("My First C# Program: {0}",
                Assembly.GetExecutingAssembly().GetName().Version);

            Person p1 = new Person("Hans", "Müller");
            Person p2 = new Person("Hans", "Müller2");
            Person p3 = new Person("Hans", "Müller3");
            Person p4 = new Person("Hans", "Müller4");

            PersonRegister pr = new PersonRegister();
            pr.ReadPersonsFromFile("Persons.txt");

            Console.WriteLine("Firstname: {0}\nSurname: {1}",
                p1.Firstname, p1.Surname);
            Console.WriteLine("Press any key to quit");

            Console.WriteLine("--- Print Persons: ---");
            PrintPersons(pr);
            Console.WriteLine("--- Sort by Firstname: ---");
            pr.Sort(pr.sortByFirstName);
            PrintPersons(pr);
            Console.WriteLine("--- Sort by Surname: ---");
            pr.Sort(pr.sortBySurName);
            PrintPersons(pr);
            Console.WriteLine("--- GetPersons: ---");
            Console.WriteLine(pr.GetPersons()[0]);

            Console.ReadKey();
        }
 private static void PrintPersons(PersonRegister personRegister)
 {
     foreach (var p in personRegister.Persons)
         Console.WriteLine("{0} {1}", p.SurName, p.FirstName);
 }