Пример #1
0
        public void TestContains()
        {
            Assert.IsTrue(_biDictionary.Contains(new KeyValuePair <int, double>(10, 5.0)));
            Assert.IsTrue(_biDictionary.Contains(new KeyValuePair <double, int>(5.0, 10)));

            Assert.IsTrue(_biDictionary.ContainsKey(10));
            Assert.IsTrue(_biDictionary.ContainsValue(5.0));

            Assert.IsTrue(_biDictionary.ContainsKey(5.0));
            Assert.IsTrue(_biDictionary.ContainsValue(10));
        }
        static void Main(string[] args)
        {
            var biDictionary = new BiDictionary<string, string, string>();

            Console.WriteLine(biDictionary.Add("one", "edno", "0000001"));
            Console.WriteLine(biDictionary.Add("two", "dve", "0000010"));
            Console.WriteLine(biDictionary.Add("three", "tri", "0000100"));

            Console.WriteLine(biDictionary.Contains("one"));
            Console.WriteLine(biDictionary.Contains("edno"));

            Console.WriteLine(biDictionary.GetValue("dve"));
            Console.WriteLine(biDictionary.GetValue("two"));
        }