Chapter 15. Delegates
What Is a Delegate?
A delegate can be thought of as an object that contains an ordered list of methods with the same signature and return type.
The list of methods is called the invocation list.
When a delegate is invoked, it calls each method in its invocation list.
Figure 15-1 represents a delegate with four methods in its invocation list.
Figure 15-1. A delegate as a list of methods
A delegate with a single method is similar to a function pointer in C++. Unlike function pointers, however, delegates are object oriented and type-safe.
Methods in the Invocation List
Methods held by a delegate can be from any class or struct, as long ...
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.