Moving Forward With .NET Events, Event-Handlers, and CustomEventArgs

See the original posting on DZone Python


In the previous post on Events, we talked about how we are surrounded by events and how useful they can be when writing loosely coupled code. We saw how we can define events, raise, and finally handle events. If you haven’t already, then I will suggest reading that post for the background and then the topics in this post will be easier to follow.

In this post, we will continue our journey and move forward with learning more about Events implementation in .NET. One of the common requirements when raising events is how can we pass data along with event notifications to event-handlers. A very common way to do it using Custom EventArgs.