开发者

what's the difference between static event handler and non-static event handler

Is there big difference between t开发者_StackOverflow社区hose two?


Semantically there are no differences, however using static event handlers can (if you're not careful) lead to memory leaks. See this article for more info.

I've come across this problem myself, trying to use a static event handler to keep an application-wide data source up to date; the event handler was preventing my BindingSource components from being disposed, leading to all sorts of weird problems...


Effectively none. All it means is that when the handler is static, there will be no this in scope (as with all static methods).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜