title: Potential downside to triggering an event?
body: <p><a href="http://msdn.microsoft.com/en-us/library/aa645739%28v=vs.71%29.aspx">Microsoft's tutorial on events</a> shows how to check an <code>event</code> for <code>null</code> before triggering it:</p>
  
  <pre><code>protected virtual void OnChanged(EventArgs e) 
  {
      if (Changed != null)
      {   // Potential Race-condition at this point!
          Changed(this, e);
      }
  }
  </code></pre>
  
  <p>But this leaves open a race-condition, as detailed in <a href="http://blogs.msdn.com/b/ericlippert/archive/2009/04/29/events-and-races.aspx"><strong>Eric Lippert's blog</strong></a>, where he writes that events should be triggered via a local event to avoid a race-condition:</p>
  
  <pre><code>protected virtual void OnChanged(EventArgs e) 
  {
      ChangedEventHandler temp = Changed;  // Local copy of the EventHandler
      if (temp != null)
      {                                    // Race condition avoided by local variable.
          temp(this, e);
      }
  }
  </code></pre>
  
  <p>While this works, it has confused many developers who get it wrong, and don't put it in the locally-scoped event.</p>
  
  <hr>
  
  <p>Another solution, from <a href="http://www.dailycoding.com/Posts/avoiding_event__null_check.aspx"><strong>DailyCoding</strong></a> is to always initialize your event to have one empty handler, so a null-check is never needed:</p>
  
  <pre><code>// Set with empty delegate, will never be null
  public event ChangedEventHandler Changed = delegate { };
  
  protected virtual void OnChanged(EventArgs e) 
  {
      // Neither Null-check nor local variable is needed; just trigger the event.
      Changed(this, e);
  }
  </code></pre>
  
  <p>This one makes a lot of sense, and is pretty simple.<br>
  However, since I see this technique so rarely mentioned online, I think there must be a reason why.<br>
  <strong>Is there a downside to initializing an event with an empty delegate like this?</strong></p>