奇怪的匿名函数之争EventHandler
class Sample
{
//event EventHandler clickSample= delegate { };//这种方式也行
event EventHandler clickSample = delegate(object sender,EventArgs e) { };
public static void Main(string[] args)
{
Sample sam1 = new Sample();
sam1.btnStartup_Click(new object(), new EventArgs());
Console.Read();
}
public void btnStartup_Click(object sender, EventArgs e)
{
this.clickSample(this, e);
}
}
}