Dynamic Call Sites and Binders

Closest to the user-written code is the call site that represents a dynamic operation. For instance, if the following code is written, two call sites result:

static void Add(dynamic a, dynamic b){    Console.WriteLine(a + b);}

Why two? Because a and b are declared as dynamic, it’s obvious that a + b is a dynamic operation. Multiple invocations of this method, with different arguments, can result in the use of different + operators, defined for different types. The + operation requires a first call site, as explained later.

So, where’s the second call site? Because a + b is a dynamic operation, its result is also typed as dynamic. This is the result of the contagious property of dynamic ...

Get C# 5.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.