开发者

Binding event without eventhandler..why it works?

I simpl开发者_Go百科y do not understand why both works:

this.timer.Tick += new EventHandler(timer_Tick);
this.timer.Tick += classA.Tick;

Thanks


Starting from v2.0 (AFAIR) of C#, EventHandler (and other delegates too) is instantiated implicitly. If you'll decompile your code you'll see that.


Check the specification:

Any method from any accessible class or struct that matches the delegate's signature, which consists of the return type and parameters, can be assigned to the delegate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜