开发者

Difference between raising event with SomeEvent(arg) and SomeEvent.Invoke(arg)

Is there any difference in using

SomeEvent(arg);

开发者_如何转开发and

SomeEvent.Invoke(arg);

If there is no significant difference, which one is the better practice?


They are exactly the same. The convention is to use the first form though.


No difference, they are equivalent. SomeEvent(arg); is just syntactic sugar for .Invoke


The first form is C# syntactic sugar for the second. I've not seen anyone use the second form, but I can imagine that some code-generators might in order to "future-proof" the code.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜