Пример #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);
        }
Пример #2
0
 static void g_byref(ref ValPoint vp)
 {
     vp.Y = 4444;
 }
Пример #3
0
 static void g_byval(ValPoint vp)
 {
     vp.Y = 1234;
 }