Example #1
0
        public static void Using_Reference_Types()
        {
            ArrayObject[] array1 = new ArrayObject[2];
            array1[0] = new ArrayObject { value1 = 0, value2 = 1 };
            array1[1] = new ArrayObject { value1 = 2, value2 = 3 };

            ArrayObject[] array2 = 
            {
                new ArrayObject { value1 = 0, value2 = 1 },
                new ArrayObject { value1 = 2, value2 = 3 }    
            };

            Console.WriteLine(array1[0].ToString() + " " + array1[1].ToString());
            Console.WriteLine(array2[0].ToString() + " " + array2[1].ToString());
        }
Example #2
0
        public static void Using_Reference_Types()
        {
            ArrayObject[] array1 = new ArrayObject[2];
            array1[0] = new ArrayObject {
                value1 = 0, value2 = 1
            };
            array1[1] = new ArrayObject {
                value1 = 2, value2 = 3
            };

            ArrayObject[] array2 =
            {
                new ArrayObject {
                    value1 = 0, value2 = 1
                },
                new ArrayObject {
                    value1 = 2, value2 = 3
                }
            };

            Console.WriteLine(array1[0].ToString() + " " + array1[1].ToString());
            Console.WriteLine(array2[0].ToString() + " " + array2[1].ToString());
        }