Removing event handlers

前端 未结 2 751
执念已碎
执念已碎 2020-11-28 12:00

Is this:

Button.Click -= new EventHandler(Button_Click);

the same as this:

Button.Click -= Button_Click;

2条回答
  •  孤街浪徒
    2020-11-28 12:10

    The end result is the same. The compiler is inferring the type of delegate automatically and as a result the new operator is not required to create it.

提交回复
热议问题