"One or more types required to compile a dynamic expression cannot be found. Are you missing referen

#事故現場:

  在一個.net 4.0 的項目中使用dynamic,示例代碼以下:express

1 private static void Main(string[] args)
2 {
3     dynamic obj;
4     obj = new { name = "jack" };
5     Console.WriteLine(obj.name);
6 }

  在讀取obj.name時,報錯:ui

One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll?spa

#解決方法:

  在項目中,添加Microsoft.CSharp.dll的引用;.net

#參考:

https://stackoverflow.com/questions/11725514/one-or-more-types-required-to-compile-a-dynamic-expression-cannot-be-found-arecode

——————————————————————————————————————————————————blog

相關文章
相關標籤/搜索