What's the reasoning behind copying a event handler to a local variable before invoking it? Resharper does this when creating a invocator, and I remember looking at a code sample on CodeProject that does this.
Code:
public class MyObject
{
public event EventHandler SomethingHappened;
protected virtual void OnSomethingHappened()
{
var handler = SomethingHappened; // Why this?
if (handler != null)
handler(this, EventArgs.Empty);
}
}