奇怪的匿名函数之争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);
        }
    }
}

posted @ 2013-03-26 14:03  Predator  阅读(208)  评论(0编辑  收藏  举报