Chapter 17. Delegates

In this chapter:

A First Look at Delegates

Using Delegates to Call Back Static Methods

Using Delegates to Call Back Instance Methods

Demystifying Delegates

Using Delegates to Call Back Many Methods (Chaining)

Enough with the Delegate Definitions Already (Generic Delegates)

C#’s Syntactical Sugar for Delegates

Delegates and Reflection

In this chapter, I talk about callback functions. Callback functions are an extremely useful programming mechanism that has been around for years. The Microsoft .NET Framework exposes a callback function mechanism by using delegates. Unlike callback mechanisms used in other platforms, such as unmanaged C++, delegates offer much more functionality. For example, delegates ensure that the callback method ...

Get CLR via C#, Fourth Edition 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.