title: Event Invocators in C#
body: <p>When I implement an event in Visual Studio, Resharper is kind enough to offer to create an event invocator for me. I usually did this by hand in the past, and my invocators always looked like this</p>
  
  <pre><code>    private void InvokePropertyChanged(PropertyChangedEventArgs e)
      {
          if (PropertyChanged != null)
          {
              PropertyChanged(this, e);
          }
      }
  </code></pre>
  
  <p>but the invocator created by Resharper looks like this (cleaned up a little by hand)</p>
  
  <pre><code>    private void InvokePropertyChanged(PropertyChangedEventArgs e)
      {
          PropertyChangedEventHandler changed = PropertyChanged;
  
          if (changed != null)
          {
              changed(this, e);
          }
      }
  </code></pre>
  
  <p>Do the people at jetbrains know something about c# I don't? Is there some technical advantage to having the local variable, or is it just an artifact of them having to auto-generate the code?</p>