On the surface, delegates seem easy to use: you define them using C#’s
delegate keyword, you construct instances of them using the familiar
new operator, and you invoke the callback using familiar "method call" syntax (except instead of a method name, you use the variable that refers to the delegate object).
However, what’s really going on is quite a bit more complex than what the earlier examples illustrate. The compilers and the common language runtime (CLR) do a lot of behind-the-scenes processing to hide the complexity. In this section, I’ll focus on how the compiler and the CLR work together to implement delegates. Having this knowledge will improve your understanding of delegates and will teach you how to use them efficiently ...