示例#1
0
文件: Program.cs 项目: ae2021/csharp1
        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
文件: Program.cs 项目: ae2021/csharp1
 static void f_byref(ref RefPoint rp)
 {
     rp = new RefPoint(4444, 4444);
     //rp.Y = 4444;
 }
示例#3
0
文件: Program.cs 项目: ae2021/csharp1
 static void f_byval(RefPoint rp)
 {
     rp = new RefPoint(1234, 1234);
     //rp.Y = 1234;
 }