var means the static type is inferred - in your case it is exactly equivalent
A a1 = new A();
All bindings are still fully static. If you look at the generated code, it will be exactly the same as with the description above.
dynamic means that any expression using a2 bound at runtime, not at compile time, so it can behave dynamically. The compiler does not check if the Foo method exists - the behavior is determined at runtime. Indeed, if an object implements IDynamicMetaObjectProvider , it can decide what to do with the call at runtime, responding to any method call (or other type of use) - in other words, it is not necessary to be "real", a method called Foo in general.
If you look at the generated code in a dynamic situation, you will find all sorts of strange and wonderful things related to sites and binders.
Jon Skeet Dec 17 '09 at 10:35 2009-12-17 10:35
source share