Chapter 16. Events

Events Are Like Delegates

The preceding chapter covered delegates. Many aspects of events are similar to those of delegates. In fact, an event is like a simpler delegate that is specialized for a particular use. Figure 16-1 illustrates that, like a delegate, an event has methods registered with it, and invokes those methods when it is invoked.

The following are some important terms related to events:

  • Raising an event: The term for invoking or firing an event. When an event is raised, all the methods registered with it are invoked—in order.

  • Publisher: A class or struct that makes an event available to other classes or structs for their use.

  • Subscriber: A class or struct that registers methods with a publisher.

  • Event handler: A method ...

Get Illustrated C# 2008 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.