日期:2014-05-18 浏览次数:20868 次
class Program { public delegate void Del(string message); public static void DelegateMethod(string message) { System.Console.WriteLine(message); } public static void MessageCallBack(int a,int b,Del callback) { callback("the number is "+(a+b).ToString()); } static void Main() { //Del hander=new Program.Del(DelegateMethod); Del hander=DelegateMethod; MessageCallBack(1,2,hander); Console.ReadKey(true); } }