O'Reilly logo

Pro C# 2008 and the .NET 3.5 Platform, Fourth Edition by Andrew Troelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11. Delegates, Events, and Lambdas

Up to this point in the text, most of the applications you have developed added various bits of code to Main(), which, in some way or another, sent requests to a given object. In Chapter 9, you examined how the interface type can be used to build objects that can "talk back" to the entity that created it. While callback interfaces can be used to configure objects that engage in two-way conversations, the .NET delegate type is the preferred manner to define and respond to callbacks under the .NET platform.

Essentially, the .NET delegate type is a type-safe object that "points to" a method, or if you wish, a list of methods, that can be invoked at a later time. Unlike a traditional C++ function pointer, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required