C H A P T E R  14

Events

Publishers and Subscribers

One common requirement in many programs is that when a particular program event occurs, other parts of the program need to be notified that the event has occurred.

One pattern for satisfying this requirement is called the publisher/subscriber pattern. In this pattern, a class, called the publisher, defines a set of events that other parts of the program might be interested in. Other classes can then “sign up” to be notified by the publisher when these events occur. These subscriber classes “sign up” for notification by supplying ...

Get Illustrated C# 2012 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.