O'Reilly logo

A Programmer's Guide to C# 5.0, 4th Edition by Nick Wienholt, Eric Gunnerson

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 22

image

Delegates, Anonymous Methods, and Lambdas

Delegates are similar to interfaces, in that they specify a contract between a caller and an implementer. Rather than specifying a set of methods, a delegate merely specifies the form of a single function. Also, interfaces are created at compile time and are a fixed aspect of a type, whereas delegates are created at runtime and can be used to dynamically hook up callbacks between objects that were not originally designed to work together.

Delegates are used as the basis for events in C#, which are the general-purpose notification mechanisms used by the .NET Framework, and they are the subject ...

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