Example #1
0
        static void Main(string[] args)
        {
            RefPoint rp = new RefPoint(2, 2);
            ValPoint vp = new ValPoint(2, 2);

            f_byval(rp);
            g_byval(vp);

            Console.WriteLine("Reference Type By Value: " + rp.Y);
            Console.WriteLine("Value Type By Value: " + vp.Y);

            f_byref(ref rp);
            g_byref(ref vp);

            Console.WriteLine("Reference Type By Ref: " + rp.Y);
            Console.WriteLine("Value Type By Ref: " + vp.Y);
        }
Example #2
0
 static void f_byref(ref RefPoint rp)
 {
     rp = new RefPoint(4444, 4444);
     //rp.Y = 4444;
 }
Example #3
0
 static void f_byval(RefPoint rp)
 {
     rp = new RefPoint(1234, 1234);
     //rp.Y = 1234;
 }