So far in this chapter, the use of delegates has required that the developer know up front the prototype of the method that is to be called back. For example, if
feedback is a variable that references a
Feedback delegate, then to invoke the delegate, the code would look like this:
feedback(items[item], item, items.Length);
As you can see, the developer must know when coding how many parameters the callback method requires and the types of those parameters. Fortunately, the developer almost always has this information and so writing code like the preceding isn’t a problem.
In some rare scenarios, however, the developer doesn’t have this information at compile time. I showed an example of this in Chapter 11 when I discussed ...