In C # 4.0, we are going to get dynamic types or objects whose "static type is dynamic", according to Anders. This will allow any call to the method call at runtime, rather than compilation time. But will it be possible to associate a dynamic object with some kind of contract (and thereby also get the full intellisense for it back), and not allow any call to it, even if you know that this is unlikely to be valid.
those. instead of just
dynamic foo = GetSomeDynamicObject();
have the ability to create or transform it in order to limit it to a known contract, for example
IFoo foo2 = foo.To<IFoo>;
or even just
IFoo foo2 = foo as IFoo;
It is impossible to find anything like this in existing materials for C # 4.0, but it seems like a logical extension of the dynamic paradigm. Anyone with more info?
source
share