static void Main()
        {
            var dict = new BiDictionary <string, int, string>();

            dict.Add("pesho", 1, "rabbit");
            dict.Add("bai ivan", 2, "frog");
            dict.Add("maria", 3, "bat");
            dict.Add("maria", 2, "donkey");
            dict.Add("pesho", 3, "bear");
            dict.Add("bai ivan", 1, "hippo");

            var peshos = dict.FindByKey1("pesho");

            foreach (var item in peshos)
            {
                Console.WriteLine(item);
            }

            var marias = dict.FindByKey1AndKey2("maria", 3);

            foreach (var item in marias)
            {
                Console.WriteLine(item);
            }
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            var personNamesAndAges = new BiDictionary <string, string, int>();

            personNamesAndAges.Add("Mariq", "Ivanova", 25);
            personNamesAndAges.Add("Mariq", "Georgieva", 24);
            personNamesAndAges.Add("Ivancho", "Kalpazancho", 13);
            var agesOfAllMarias = personNamesAndAges.FindByFirstKey("Mariq");

            Console.WriteLine("Ages of girls with first name Mariq: {0}", string.Join(", ", agesOfAllMarias));
            var agesOfAllMariaIvanova = personNamesAndAges.FindByBothKeys("Mariq", "Ivanova");

            Console.WriteLine("Ages of girls named Mariq Ivanova: {0}", string.Join(", ", agesOfAllMariaIvanova));
            var agesOfAllKalpazanchos = personNamesAndAges.FindBySecondKey("Kalpazancho");

            Console.WriteLine("Ages of boys with last name Kalpazancho: {0}", string.Join(", ", agesOfAllKalpazanchos));
        }