Combining Delegates

In preparation for the discussion about events in Chapter 18, I want to mention one more thing about delegates: their capability to be used in a “multicast setting.” Earlier on, you saw how delegate types in C# derive from a base class called MulticastDelegate. Looking at that type’s information in Visual Studio, you see how that type by itself derives from Delegate:

namespace System{    public abstract class MulticastDelegate : Delegate    {        ...

Looking a bit further at the members of the MulticastDelegate type, you’ll notice one that reveals its true essential goal, allowing multiple target methods to be called as part of the delegate’s invocation call. This is hinted at in Figure 17.27 ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.