I know that anonymous functions are not supported as arguments to a dynamic method call. What are other such limitations of DLR in .NET 4.0?
You can use anonymous functions, you just have to cast them first:
dynamic list = new List<string>() { "10", "20" };
dynamic converted = list.ConvertAll((Func<string, int>) (x => int.Parse(x)));
The same is true of method group conversions:
foo.Click += (EventHandler) MyClickHandler;
Other restrictions I've encountered so far:
dynamic
in a type constraintYou can't use dynamic
as a type argument in an interface for a class declaration, but you can use it as a type argument for a base class, i.e.
class Invalid : IEnumerable<dynamic>
class Valid : List<dynamic>
Extension methods aren't discoverable at execution time (but you can call the static method directly with dynamic arguments)
dynamic[]
to IEnumerable<dynamic>
- that will be fixed for the release.dynamic
as a base class(Note that these are limitations of C# 4.0 as much as of the DLR itself. I got the impression that was what you meant though.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With