using System;
using System.Collections.Generic;
using System.Text;
namespace 委托
{
class Program
{
public delegate void Del(string message);
//public delegate void SortDelegate(int[] SortArray);
public static void Show(string message)
{
Console.WriteLine(message);
}
static void Main(string[] args)
{
Del handler = new Del(Show);
handler("委托给Show");
MethodWithCallBack(1, 5, handler); //异步回调
}
public static void MethodWithCallBack(int param1,int param2,Del callback)
{
callback("the number is "+Convert.ToString(param1+param2));
}
}
}