O'Reilly logo

The C# Programming Language (Covering C# 4.0), Fourth Edition by Peter Golde, Scott Wiltamuth, Mads Torgersen, Anders Hejlsberg

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

15. Delegates

Delegates enable scenarios that other languages—such as C++, Pascal, and Modula—have addressed with function pointers. Unlike C++ function pointers, however, delegates are fully object oriented. Also, unlike C++ pointers to member functions, delegates encapsulate both an object instance and a method.

Bill Wagner

I experience a strange sense of amazement upon reading this small chapter in the language specification. Delegates have been part of C# since the 1.0 release. At that time, most of the C# community (including me) saw delegates as a little extra ceremony around events. Ten years later, I can’t imagine the C# language without delegates. They are something most of us use every day in LINQ queries, function composition, ...

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