Should I Create a New Delegate Instance?

前端 未结 2 1751
感情败类
感情败类 2020-12-19 04:02

What are the implications of doing this...

this.myButton.Click += new EventHandler(this.myButton_Clicked);

...versus this?

         


        
2条回答
  •  甜味超标
    2020-12-19 04:43

    The 2nd syntax is a shortcut for the 1st one introduced in C# 2.0.

    http://www.developer.com/net/csharp/article.php/3103031/Working-with-Delegates-Made-Easier-with-C-20.htm

提交回复
热议问题