Chapter 20. DELEGATES AND EVENTS

You will learn about the following in this chapter:

  • What a delegate is

  • Defining and instantiating delegates

  • Using delegates as arguments to method calls and creating arrays of delegates

  • Multicast delegates and why they are useful for implementing event-driven programs

  • What an event is and how it can be implemented with a delegate

  • The basic architecture of a typical event-driven program

Recall from Chapter 17, “Inheritance Part II: abstract Functions, Polymorphism, and Interfaces” how inheritance enabled us to reference objects of different subclasses (such as Circle, Rectangle and Triangle) with the same variable of a common ancestor class (such as Shape). Through dynamic binding (by calling DrawYourself in Shape

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.