O'Reilly logo

.NET Common Language Runtime Unleashed by Kevin Burton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

events Make Working with delegates Easier

Particularly for UI code, events are the primary means of notification. Button clicks, mouse over, list expansion, and so on all use events to notify the application of the occurrence of an event. events are based on delegates, so many of the same principles apply to events that apply to delegates. Events are so similar to delegates that the benefits of events are not readily apparent. Maybe a couple of examples will help you appreciate an event.

Beginning events

The first sample shows how an event can be used to notify an application that something has changed. For this sample, the change is incrementing and decrementing an integer. After each modification, the registered events are called. A portion ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required