方法的调用 delegate int test1(int a); class Program { static int num = 10; static void Main(string[] args) { test1 t = new test1(max); t(40); Console.WriteLine("max,{0}", num); Console.ReadLine(); } public static int max(int a) { num += a; return num; } }
类额实例化 class weituo { public int num = 10; //非静态 public int max(int a) { num += a; return num; } } Main () { weituo wt = new weituo(); test1 t1 = new test1(wt.max); t1(50); }
原文:http://www.cnblogs.com/codemouserman/p/4280681.html