Chapter 10. Delegates, Events, and Anonymous Methods
Delegates are special types that encapsulate a method, similar to function pointers found in other programming languages. Delegates have a number of uses in C#, but you are most likely to encounter a special type of delegate—the event. Events make notifying interested parties simple and flexible, and I'll explain the convention for their use later in the chapter.
I'll also explain the Func
and Action
types that let you use delegates in a more convenient form and that are used extensively in some of the latest C# language features, such as parallel programming.
We'll finish up this chapter with a look at anonymous methods and lambda expressions, two C# features that let us implement delegates without ...
Get Introducing Visual C# 2010 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.