Dynamic Language Extensions in C# 4

C# 4 introduces the dynamics.

In contrast to the var keyword, witch the type is determined at compile-time, the dynamic keyword is type safe too, but its type is determined at runtime.

There are then:

  • the DynamicObject class: you have to derive from it, and implement the TryGetMember, TrySetMember and TryInvokeMember methods;
  • the ExpandObject: this class is sealed and you have to use it as it is.

Add comment