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

Removing delegates

Now that you have some understanding of how delegates are compared, you can move on to how delegates are removed from a delegate chain. A delegate chain is simply an array of delegates. To remove a delegate from the chain, the chain is traversed and the first delegate that equals the delegate passed as an argument to Remove will be removed. Some examples best illustrate the concepts regarding delegate removal. The full source code for the code illustrated in Listings 14.1514.17 is in the DelegateRemoval directory.

Listing 14.15. Listing delegates in a delegate Chain
 DelegateCallback ad = new DelegateCallback(ACallback); DelegateCallback bd = new DelegateCallback(BCallback); DelegateCallback cd = new DelegateCallback(CCallback); ...

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