static void Main(string[] args) { do { Console.Clear(); MainMenu(); var option = Console.ReadKey(true).Key; switch (option) { case ConsoleKey.D1: var createdPerson = _personFactory.CreatePerson(); _personsReopsitory.AddPerson(createdPerson); break; case ConsoleKey.D2: PrintAscending(_allPersons); break; case ConsoleKey.D3: Console.WriteLine("Please enter searched age"); var age = int.Parse(Console.ReadLine()); PrintOccuranceOfGivenAge(_allPersons, age); break; case ConsoleKey.D4: PrintAllPersons(_allPersons); break; } } while (Console.ReadKey().Key != ConsoleKey.Escape); }