static void Main() { var path = @"../../records.txt"; var phonebook = new PhoneBook(); PopulatePhoneBookFromFile(phonebook, path); Console.WriteLine(string.Join(", ", phonebook.Find("mimi"))); Console.WriteLine(string.Join(", ", phonebook.Find("gancho"))); }
private static void ExecuteCommands(List<string> commands, PhoneBook phoneBook) { foreach (var command in commands) { List<PhoneEntry> found = new List<PhoneEntry>(); string[] arguments = command.Split(); if (arguments.Length == 1) { found = phoneBook.Find(arguments[0]); } else if (arguments.Length == 2) { found = phoneBook.Find(arguments[0], arguments[1]); } PrintFoundEntries(found, command); } }
private static void ExecuteCommands(List <string> commands, PhoneBook phoneBook) { foreach (var command in commands) { List <PhoneEntry> found = new List <PhoneEntry>(); string[] arguments = command.Split(); if (arguments.Length == 1) { found = phoneBook.Find(arguments[0]); } else if (arguments.Length == 2) { found = phoneBook.Find(arguments[0], arguments[1]); } PrintFoundEntries(found, command); } }