In C# what is the advantage of
public class blah { public event EventHandler Blahevent; }
versus
public class blah { private event EventHandler blahevent; public event EventHandler Blahevent { add { blahevent+=value; } remove { blahevent-=value } } }
or vice versa.
does the first one open you up to blahinstance.Blahevent = null, or blahinstance.Blahevent(obj,even)
There is no advantage to explicit implementation of the add/remove methods unless you want to do something different. Possible reasons:
What the default implementation does is maintain a private hidden delegate field which is replaced each time a delegate is added or removed. For most cases there is no need to do any of the above but the flexibility is there.