I would not do this.
There are two reasons for this. Firstly, it's standard to simply check the handler for null
before calling this. You see this all over the place, in examples, in the Microsoft reference source and in the manuals.
Second, initializing your events this way allocates unnecessary objects when creating your class. This will put extra memory pressure on your application without a real need. This is because:
public event EventHandler<LoadEventArgs> LoadedData = delegate { };
translates to:
public event EventHandler<LoadEventArgs> LoadedData = new EventHandler<LoadEventArgs>delegate { });
If you don't do this already, wrapping your events in specific methods helps a lot:
public event EventHandler MyEvent;
protected virtual void OnMyEvent(EventArgs e)
{
if (MyEvent != null)
MyEvent(this, e);
}
You can make this thread safe(r) using the following:
public event EventHandler MyEvent;
protected virtual void OnMyEvent(EventArgs e)
{
var handler = MyEvent;
if (handler != null)
handler(this, e);
}