Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            int a = 10;
            int b = a;
            b++;
            Console.WriteLine(string.Format("a : {0}, b : {1}", a, b));

            int[] array1 = new int[3] { 1, 2, 3 };
            int[] array2 = array1;
            array2[0] = 0;
            Console.WriteLine(string.Format("array1[0] : {0}, array2[0] : {1}", array1[0], array2[0]));

            var number = 1;
            Increment(number);
            Console.WriteLine(number); //number is still 1, not incremented due to scope

            var person = new Person() { Age = 20 };
            MakeOld(person);
            Console.WriteLine(person.Age);
        }
Ejemplo n.º 2
0
 public static void MakeOld(Person person)
 {
     person.Age += 10;
 }