C#使用简单的例子委托理解

时间:2014-05-19 09:06:23

标签: c# events delegates

这两行有什么不同吗?他们在做同样的事吗?

c1.AboutToBlow += new EventHandler<CarEventArgs>(c1_AboutToBlow);

c1.AboutToBlow += c1_AboutToBlow;


static void c1_AboutToBlow(object sender, CarEventArgs e)
        {
            Console.WriteLine("Hello!");
        }

0 个答案:

没有答案