Beispiel #1
0
        static void Main(string[] args)
        {
            MyDictionary <int, string> my = new MyDictionary <int, string>(10);

            for (int i = 0; i < 22; i++)
            {
                my.Add(i, "My" + (i + 1));
            }
            my.DictionaryInfo();

            Console.WriteLine();
            Console.WriteLine(my.ContainsKey(11));
            Console.WriteLine(my.ContainsKey(110));

            my.Remove(1);
            Console.WriteLine();
            my.DictionaryInfo();

            Console.WriteLine();
            Console.WriteLine(my.ContainsValue("My11"));
            Console.WriteLine(my.ContainsValue("My110"));

            Console.WriteLine();
            my.Clear();
            my.DictionaryInfo();

            Console.WriteLine();
            Console.WriteLine(my.ContainsKey(11));

            Console.WriteLine();
            for (int i = 0; i < 3; i++)
            {
                my.Add(i, "My" + (i + 1));
            }
            my.Remove(1);

            Console.WriteLine();
            my.DictionaryInfo();

            Console.ReadKey();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var dict = new MyDictionary <int, int>();

            for (var i = 0; i < 100; i++)
            {
                dict.Add(i, i);
            }
            dict.Remove(11);
            Console.WriteLine(dict.ContainsKey(153));
            Console.WriteLine(new string('-', 30));
            Console.WriteLine(dict.Count);
        }