Whys 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/09 22:02 UTC
Read the original article Hit count: 129

Filed under:
|

I have seen people define their events like this:

public event EventHandler 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

Related posts about c#

Related posts about events