コード例 #1
0
        // A class can use the same indexing mechanism to provide indexed property values.
        // Note that there is nothing stopping the use of other types in indexed properties.This is how the Dictionary collection is used to index on a
        // particular type of key value.
        public void IndexedProperties()
        {
            IntArrayWrapper x = new IntArrayWrapper();

            x[0] = 99;
            Console.WriteLine(x[0]);
        }
コード例 #2
0
        private static void IndexedPropertiesExample()
        {
            IntArrayWrapper x = new IntArrayWrapper();

            x[0] = 99;
            Console.WriteLine(x[0]);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            IntArrayWrapper x = new IntArrayWrapper();

            x[0] = 99;
            Console.WriteLine(x[0]);
            Console.ReadKey();
        }
コード例 #4
0
        public static void executeTest()
        {
            IntArrayWrapper intArray = new IntArrayWrapper();

            intArray[0] = 99;
            Console.WriteLine(intArray[0]);
            Console.ReadKey();
        }
コード例 #5
0
        public static void TestMyIntArray()
        {
            IntArrayWrapper x = new IntArrayWrapper();

            x[0] = 99;
            Console.WriteLine(x[0]);

            NamedIntArray xx = new NamedIntArray();

            xx["zero"] = 99;
            Console.WriteLine(xx["zero"]);
        }
コード例 #6
0
        public static void RunSummary()
        {
            Student std1 = new Student();

            std1.StudentName = "Bill";

            ChangeReferenceType(std1);

            Console.WriteLine(std1.StudentName); //when we send the Student object std1 to the ChangeReferenceType() method, what is actually sent is the memory address of std1. Thus, when the ChangeReferenceType() method changes StudentName, it is actually changing StudentName of std1, because std1 and std2 are both pointing to the same address in memory.



            IntArrayWrapper x = new IntArrayWrapper();

            x[1] = 99;
            Console.WriteLine("Indexed properties " + x[1]);

            Console.ReadLine();
        }