title: Raising C# events with an extension method - is it bad?
body: <p>We're all familiar with the horror that is C# event declaration.  To ensure thread-safety, <a href="http://blogs.msdn.com/brada/archive/2005/01/14/353132.aspx" rel="noreferrer">the standard is to write something like this</a>:</p>
  
  <pre><code>public event EventHandler SomethingHappened;
  protected virtual void OnSomethingHappened(EventArgs e)
  {            
      var handler = SomethingHappened;
      if (handler != null)
          handler(this, e);
  }
  </code></pre>
  
  <p>Recently in some other question on this board (which I can't find now), someone pointed out that extension methods could be used nicely in this scenario.  Here's one way to do it:</p>
  
  <pre><code>static public class EventExtensions
  {
      static public void RaiseEvent(this EventHandler @event, object sender, EventArgs e)
      {
          var handler = @event;
          if (handler != null)
              handler(sender, e);
      }
      static public void RaiseEvent&lt;T&gt;(this EventHandler&lt;T&gt; @event, object sender, T e)
          where T : EventArgs
      {
          var handler = @event;
          if (handler != null)
              handler(sender, e);
      }
  }
  </code></pre>
  
  <p>With these extension methods in place, all you need to declare and raise an event is something like this:</p>
  
  <pre><code>public event EventHandler SomethingHappened;
  
  void SomeMethod()
  {
      this.SomethingHappened.RaiseEvent(this, EventArgs.Empty);
  }
  </code></pre>
  
  <p>My question: Is this a good idea?  Are we missing anything by not having the standard On method?  (One thing I notice is that it doesn't work with events that have explicit add/remove code.)</p>