委托
class Program { //声明委托 delegate int MyDelegate(int x, int y); static void Main(string[] args) { MyDelegate _myDelegate = new MyDelegate(fun1); _myDelegate += fun2; Console.WriteLine(_myDelegate(10,23)); Console.ReadKey();//输出10,返回最后一个注册函数的返回值 } static int fun1(int x, int y) { return x + y; } static int fun2(int x, int y) { return x; } }