There are a few limitations and things that might work differently
than you would expect.
The DLR allows objects to be created from
objects that represent classes. However, the current implementation of C#
doesn’t have syntax to support this.
Dynamic lookup will not be able to find
extension methods. Whether extension methods apply or not depends on the static
context of the call (i.e. which using clauses occur), and this context information
is not currently kept as part of the payload.
Anonymous functions (i.e. lambda expressions)
cannot appear as arguments to a dynamic method call. The compiler cannot bind
(i.e. “understand”) an anonymous function without knowing what type it is
One consequence of these limitations is that you cannot
easily use LINQ queries over dynamic objects:
dynamic collection = …;
var result = collection.Select(e => e + 5);
If the Select method is an
extension method, dynamic lookup will not find it. Even if it is an instance
method, the above does not compile, because a lambda expression cannot be
passed as an argument to a dynamic operation.
There are no plans to address these limitations in C# 4.0.
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, sup, u