Raise and handle events generically


/ Published in: C#
Save to your folder(s)

For a discussion of .NET events best-practices, see [Roy Osherove's blog post](http://weblogs.asp.net/rosherove/articles/DefensiveEventPublishing.aspx) and [this post](http://blogs.msdn.com/ericlippert/archive/2009/04/29/events-and-races.aspx). Be sure to read the comments sections for some good arguments for and against the presented methods. Also, there is a good [MSDN Magazine article on Event Accessors](http://msdn.microsoft.com/en-us/magazine/cc163533.aspx), which may be useful.

Used in "Empire." The example shows an EventArgs with a DateTime object, but it could be a string or enumeration or whatever.

URL: http://geekswithblogs.net/HouseOfBilz/archive/2009/02/15/re-thinking-c-events.aspx

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.