public static void Main() { var multi = new BiDictionary <int, string, string>(); multi.Add(1, "one", "firstElement"); multi.Add(1, "two", "mixed"); multi.Add(2, "two", "secondElement"); Console.WriteLine("first key :"); var result1 = multi.FindByFirstKey(1); foreach (var item in result1) { Console.WriteLine(item); } Console.WriteLine("second key :"); var result2 = multi.FindBySecondKey("two"); foreach (var item in result2) { Console.WriteLine(item); } Console.WriteLine("both keys :"); var result3 = multi.FindByBothKeys(1, "two"); foreach (var item in result3) { Console.WriteLine(item); } }
static void Main() { var dictionary = new BiDictionary <int, double, string>(); dictionary.Add(1, 1.5, "mariq"); dictionary.Add(3, 3.01, "GANCHO"); dictionary.Add(1, 1.5, "pesho"); dictionary.Add(2, 50.9, "gosho"); dictionary.Add(2, 50.9, "drago"); dictionary.Add(2, 50.9, "dragan"); var byFirstKey = dictionary.FindByFirstKey(1); Console.WriteLine("search by first key: {0}", string.Join(", ", byFirstKey)); var bySecondKey = dictionary.FindBySecondKey(3.01); Console.WriteLine("search by second key: {0}", string.Join(", ", bySecondKey)); var byBothKeys = dictionary.FindByBothKeys(2, 50.9); Console.WriteLine("search by both keys: {0}", string.Join(", ", byBothKeys)); }