Created
May 12, 2009 18:03
-
-
Save virtualstaticvoid/110629 to your computer and use it in GitHub Desktop.
Generic event firing in C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace MyNamespace | |
{ | |
public static class MyExtensions | |
{ | |
public static void Fire<TSender, TEventArgs>(this EventHandler<TSender, TEventArgs> myEvent, TSender sender, TEventArgs e) | |
where T EventArgs: EventArgs | |
{ | |
if(myEvent != null) | |
myEvent(sender, e); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment