Beispiel #1
0
        static void DoOverloadedIndexer(int size, string value)
        {
            OverloadedIndexer myIndex = new OverloadedIndexer(size);

            myIndex[9] = "Some vallue";
            myIndex[3] = "Another value";
            myIndex[5] = "Any Value";

            myIndex["Empty"] = value;

            Console.WriteLine("\nOverloadedIndexer Output\n");
            for (int i = 0; i < size; i++)
            {
                Console.WriteLine("myIndex[{0}]: {1}", i, myIndex[i]);
            }
            Console.WriteLine(myIndex[value]);
            Console.ReadKey();
        }
Beispiel #2
0
        static void DoOverloadedIndexer(int size, string value)
        {
            OverloadedIndexer myIndex = new OverloadedIndexer(size);

            myIndex[9] = "Some vallue";
            myIndex[3] = "Another value";
            myIndex[5] = "Any Value";

            myIndex["Empty"] = value;

            Console.WriteLine("\nOverloadedIndexer Output\n");
            for (int i = 0; i < size; i++)
            {
                Console.WriteLine("myIndex[{0}]: {1}", i, myIndex[i]);
            }
            Console.WriteLine(myIndex[value]);
            Console.ReadKey();
        }