C#/.NET Little Wonders: The EventHandler and EventHandler<TEventArgs>

added by BlackRabbitCoder
11/18/2011 8:51:32 AM

1 Kicks, 78 Views

Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can help improve your code by making it easier to write and maintain. In the last two weeks, we examined the Action family of delegates (and delegates in general), and the Func family of delegates and how they can be used to support generic, reusable algorithms and classes. So this week, we are going to look at a handy pair of delegates that can be used to eliminate the need for defining custom delegates when creating events: the EventHandler and EventHandler<TEventArgs> delegates.


2 comments

BlackRabbitCoder
11/17/2011 7:32:30 PM
New post!

dpeterson
11/18/2011 8:51:56 AM
Thanks again for keeping these going. I like your simple approach to thread safety with checking for null delegates.