private void Grow() { var newSlots = new HashDict <TKey, TValue>(this.Capacity * 2); foreach (var item in this) { newSlots.Add(item.Key, item.Value); } this.slots = newSlots.slots; this.Count = newSlots.Count; }
static void Main(string[] args) { HashDict <string, string> table = new HashDict <string, string>(); string input = string.Empty; bool search = false; while ((input = Console.ReadLine()) != "end") { if (!search) { search = input == "search" ? true : false; } if (!search) { string[] commandArgs = input.Split('-'); string name = commandArgs[0]; string number = commandArgs[1]; if (!table.ContainsKey(name)) { table.Add(name, number); } } else if (input != "search") { if (!table.ContainsKey(input)) { Console.WriteLine($"Contact {input} does not exist."); } else { Console.WriteLine($"{input} -> {table[input]}"); } } } Console.ReadLine(); }