【发布时间】:2021-12-06 23:04:40
【问题描述】:
我在我的 C# 项目中使用了 dynamic 关键字。我收到以下错误
找不到编译动态表达式所需的一种或多种类型。
以下是我的代码,我们使用 VS 2013 和 .NET Framework 4.5.1。
dynamic cstmDocProp = (Microsoft.Office.Core.DocumentProperties)mScribeShell.ScribeShell.ActiveWordDoc.CustomDocumentProperties;
string s = String.Empty;
s = Convert.ToString(cstmDocProp[mConstants.g_sPROPERTY_DOCUMENT_INDEX].Value);
我已经按照其他链接中的建议引用了 Microsoft.Chasharp DLL 和 System.Core DLL。
在引用 Microsoft.Csharp DLL 后,我收到另一个错误
未定义或导入预定义类型 microsoft.csharp.runtimebinder。
【问题讨论】:
-
如果您觉得 Tom 的回答有帮助,请接受。
标签: c#