Events

An event represents a signal that something noteworthy has happened in a program. Examples of events are a button click, a key press, a timer lapsing one minute, and a printer finishing printing. An object with the ability to generate events is called a publisher and is a source of events. To generate an event is also called to fire an event.

One or more objects can subscribe (or register) to be notified about a certain event fired from another object. These objects are called subscribers or listeners. Each subscriber must contain a method called an event handler to handle the event the subscriber has subscribed to be notified about. All subscribing event handlers are invoked one after the other when the corresponding event is fired. A ...

Get C# Primer Plus 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.