One of the core features introduced in C# 4.0 is called Dynamic Lookup which allows a unified approach to invoking things dynamically. C# 3.0 was all about Language Integrated Query (LINQ) and C# 4.0 is all about dynamic programming. C# 4.0 brings some of flexibility and declarative style of programming to C#. C# 4.0 features a new dynamic keyword that allows you to mix in a bit of late-bound code in the midst of your otherwise statically typed code. It is used as a data type in much the same way the var keyword is used. The biggest reason is that it allows a C# program to use dynamic dispatch to more naturally create objects coming from a dynamic language.
As an example, suppose you have a method like this:
Code:
public dynamic myMethod()
{
// Get your work done here...
}
and you call it as:
Code:
dynamic callMethod = myMethod();
callMethod.Do("Your Job");
The C# 4.0 compiler allows you to call a method with any name and any arguments because callMethod is declared as "dynamic".
Bookmarks