2.12. The delegate Type

A delegate type creates a kind of function object. The delegate type looks like a function declaration, but instead it defines a type that can refer to one or multiple functions of a particular signature and return type. A delegate type has three primary characteristics:

  1. A delegate object can address multiple methods rather than only one method at a time. When we invoke a delegate that addresses multiple methods, the methods are invoked in the order in which they are assigned to the delegate object. We'll see how to do that shortly.

  2. The methods addressed by a delegate object do not need to be members of the same class. All the methods addressed by a delegate object must share the same prototype and signature. Those methods, ...

Get C# Primer: A Practical Approach 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.