Пример #1
0
        public static void Main()
        {
            var testBiDictionary = new BiDictionary <int, double, string>();

            testBiDictionary.Add(1, 1, "Pesho");
            testBiDictionary.Add(1, 1, "Gosho");
            testBiDictionary.Add(1, 2, "Stamat");
            testBiDictionary.Add(2, 14, "Penko");
            testBiDictionary.Add(2, 3, "Haralampi");

            var testFindByKey1    = testBiDictionary.Find(2);
            var testFindByKey2    = testBiDictionary.Find(1d);
            var testFindByTwoKeys = testBiDictionary.Find(2, 3d);

            Console.WriteLine("Results from first search: {0}", string.Join(", ", testFindByKey1));
            Console.WriteLine("Results from second search: {0}", string.Join(", ", testFindByKey2));
            Console.WriteLine("Results from third search: {0}", string.Join(", ", testFindByTwoKeys));

            testBiDictionary.Remove(2, 14, "Penko");
            var expectedNull = testBiDictionary.Find(2, 14);

            if (expectedNull == null)
            {
                Console.WriteLine("Remove successfull!");
            }
        }
Пример #2
0
        public static void Main(string[] args)
        {
            BiDictionary <int, string, string> dictionary = new BiDictionary <int, string, string>();
            var key1 = 1;
            var key2 = "2";

            dictionary.Add(key1, key2, "valid keys 1");
            dictionary.Add(key1, key2, "valid keys 2");
            Console.WriteLine("==========Find(key1)==========");
            Console.WriteLine(dictionary.Find(key1));
            Console.WriteLine("==========Find(key2)==========");
            Console.WriteLine(dictionary.Find(key2));
            Console.WriteLine("==========Find(key1, key2)==========");
            Console.WriteLine(dictionary.Find(key1, key2));
            var key3 = 1;
            var key4 = "4";

            dictionary.Add(key3, key4, "default value INVALID");
        }