The dynamic Keyword in C# 4.0

One of the key features in .NET 4.0 is the support for reaching out to dynamically typed code (and object models representing data) from inside flagship languages such as C# and Visual Basic. The single syntactical presence of this feature in C# is the new dynamic keyword. When an object is typed as dynamic, the compiler emits code that causes all binding and dispatch operations to be deferred until runtime, instead of statically resolving them at compile time.

So, what’s binding and dispatching all about? Binding is essentially the act of figuring out the meaning of the code with regard to intended method calls, uses of members, and so on. To make this work at runtime, enough information about the intent of the ...

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.