delegaye \ event 的基本使用方法
public delegate void Operate();
class Program
{
static event Operate OperateHandler;
static void Main(string[] args)
{
OperateHandler += MethodA;
OperateHandler += MethodB;
OnOperate();
}
private static void OnOperate()
{
if (OperateHandler != null)
OperateHandler();
}
static void MethodA()
{
Console.WriteLine("Hello");
}
static void MethodB()
{
Console.WriteLine("World");
}
}