C#: How To Implement Events

events-logo
Credits to http://www.digitimer.com

 

I remember the time when my Team Lead asked me to implement an Event type solution for the problem that we have encountered in our previous projects. It was my first time to implement such technique and I was kinda daunted of the said task. In today’s session I’m going to discuss, in the most simplest manner, about raising and consuming events with and without parameters.

EVENTS

What are Events? Events are way for a Class to provide notifications for its clients. Do you remember when we use a button in a Windows form? When we double click the button it will navigate to Button Click which is an event. It is heavily used in GUI related matters but is still very useful for objects to signal if there were any state changes.

Continue reading