The Two Sides of Delegates

Delegates really have two sides to them. One side defines one or more target methods referred to by the (multicast) delegate; the other defines a way to invoke those methods through the delegate. To keep things clear, let’s define a little bit of vocabulary here. We’ll say a target method gets called, whereas a delegate is getting invoked. With those words in place, we can sketch our current understanding of delegates as shown in Figure 18.1.


FIGURE 18.1 Invoking a delegate is an interactive act.

When we look at the picture from left to right, delegates look like very interactive beasts, where the invocation site is ...

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.