Creating and Raising Events

There is not much functionality you can build using the .NET languages without events. Events enable one piece of code to notify another bit of code that something has just happened. Code that raises events are said to publish an event and those that receive the event notice are said to subscribe to events. A simple example is when you write a user interface for the Web or Windows. In these cases, you are consistently adding code that subscribes to events published by the UI such as a user clicking on a button control. Of course an event may have more than a single subscriber and subscribers may be subscribed to multiple events.

Create an Event

When you create an event you need to determine if you need to pass custom ...

Get Microsoft® Visual Studio® 2010 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.