O'Reilly logo

.NET Common Language Runtime Unleashed by Kevin Burton

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

Summary

delegates are used throughout the framework, so they are important. You should incorporate a delegate into your design in the following cases:

  • A single method is called. Unlike an interface, a delegate specifies a single method's signature.

  • A class needs to have multiple implementations of a method. Take, for instance, the qsort example given at the beginning of the chapter. You could very well imagine allowing a compare delegate to be passed to the qsort routine so that different objects could be sorted.

  • You need to have an event-like model for processing in your application. In other words, if your application is designed so that it is more readily implemented using an asynchronous event model, then you should consider delegates and ...

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