static void Main(string[] args) { // Пример использования. var dict = new CompositeKeyDictionary <Person, Address, House>(); var ind = 1; var addressToSelect = new Address($"Country_{ind}", $"City{ind}", $"Street_{ind}", ind); Person personToSelect; FillDictionary(dict, out personToSelect); Console.WriteLine("All items:"); foreach (var item in dict) { Console.WriteLine(item.ToString()); } Console.WriteLine(); Console.WriteLine($"Selected by address: {addressToSelect}"); foreach (var item in dict.GetValuesByKey2(addressToSelect)) { Console.WriteLine(item.ToString()); } Console.WriteLine(); Console.WriteLine($"Selected by person: {personToSelect}"); foreach (var item in dict.GetValuesByKey1(personToSelect)) { Console.WriteLine(item.ToString()); } Console.ReadLine(); }
static void Main(string[] args) { // Пример использования. var dict = new CompositeKeyDictionary<Person, Address, House>(); var ind = 1; var addressToSelect = new Address($"Country_{ind}", $"City{ind}", $"Street_{ind}", ind); Person personToSelect; FillDictionary(dict, out personToSelect); Console.WriteLine("All items:"); foreach (var item in dict) { Console.WriteLine(item.ToString()); } Console.WriteLine(); Console.WriteLine($"Selected by address: {addressToSelect}"); foreach (var item in dict.GetValuesByKey2(addressToSelect)) { Console.WriteLine(item.ToString()); } Console.WriteLine(); Console.WriteLine($"Selected by person: {personToSelect}"); foreach (var item in dict.GetValuesByKey1(personToSelect)) { Console.WriteLine(item.ToString()); } Console.ReadLine(); }
public void GetValuesByKey2_NoValue() { Assert.AreEqual(_dict.GetValuesByKey2(_firstAddr), Enumerable.Empty <House>()); }