Mot*_*tti 43 c# extension-methods dynamic c#-4.0
我听谈话约C#4的dynamic关键词,我想知道......请问这个功能是正交的其它.NET功能,例如将它支持扩展方法?
public static class StrExtension {
public static string twice(this string str) { return str + str; }
}
...
dynamic x = "Yo";
x.twice(); // will this work?
Run Code Online (Sandbox Code Playgroud)
注意:这个问题是在C#4发布之前提出的,这就是为什么它将在未来时使用.