Thread safe event raising

public static class EventHandlerExtensions
{
    public static void Raise<T>(this EventHandler<T> eventHandler, object sender, T e) where T : EventArgs
    {
        var handler = eventHandler;
        if (handler != null)
        {
            handler(sender, e);
        }
    }
}
Example:
public event EventHandler<SomeEventArgs> SomeEvent;

SomeEvent.Raise(this, e);

Description

Allows thread-safely raise any event.

Details

Double click on the code to select all.

 

;