Why is this event declared with an anonymous delegate?
Posted
by John_Sheares
on Stack Overflow
See other posts from Stack Overflow
or by John_Sheares
Published on 2010-06-09T21:58:42Z
Indexed on
2010/06/10
3:02 UTC
Read the original article
Hit count: 198
I have seen people define their events like this:
public event EventHandler<EventArgs> MyEvent = delegate{};
Can somebody explain how this is different from defining it without it? Is it to avoid checking for null when raising the event?
© Stack Overflow or respective owner