C# this 关键字
class A { public int num = 3; public void m1(B b) { b.m2(this); } } class B { public void m2(A a) { Console.WriteLine(a.num); } } class Test { public static void Main(string[] args) { A a = new A(); B b = new B(); a.m1(b); //3 } }
class A { public int num = 3; public void m1(B b) { b.m2(this); } } class B { public void m2(A a) { Console.WriteLine(a.num); } } class Test { public static void Main(string[] args) { A a = new A(); B b = new B(); a.m1(b); //3 } }