O'Reilly logo

Applied Microsoft® .NET Framework Programming by Jeffrey Richter

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

Delegate Chains

By themselves, delegates are incredibly useful. But add in their support for chaining, and delegates become even more useful. I’ve already mentioned that each MulticastDelegate object has a private field, called _prev. This field holds a reference to another MulticastDelegate object; that is, every object of type MulticastDelegate (or any type derived from MulticastDelegate) has a reference to another MulticastDelegate-derived object. This field allows delegate objects to be part of a linked list.

The Delegate class defines three static methods that you can use to manipulate a linked-list chain of delegate objects.

class System.Delegate { // Combines the chains represented by head and tail; head is returned. // NOTE: head will be ...

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