示例#1
0
文件: Program.cs 项目: 3141592/vs
        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();
        }
示例#2
0
文件: Program.cs 项目: 3141592/vs
        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();
        }