Combining Delegates

In preparation for the discussion about events in the 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

Figure 17.27. MulticastDelegate ...

Get C# 4.0 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.