在C#中使用`dynamic`关键字不会编译 [英] Using `dynamic` keyword in C# doesn't compile
问题描述
我正在尝试编译一个包含动态
关键字的C#代码。
(我需要这个关键字使用ironpython。)
但是,它不编译,抱怨
I'm trying to compile a piece of C# code that contains the dynamic
keyword.
(I need this keyword for using ironpython.)
However, it doesn't compile, complaining that
error CS1980: Dynamic keyword requires
`System.Runtime.CompilerServices.DynamicAttribute' to be defined.
Are you missing System.Core.dll assembly reference?
我使用的编译器是 Mono JIT编译器版本2.10.8.1
。
在可能的引用列表中,我没有 System.Runtime.CompilerServices.DynamicAttribute
。
The compiler I'm using is Mono JIT compiler version 2.10.8.1
.
I don't have System.Runtime.CompilerServices.DynamicAttribute
in the list of possible references.
如何使单声道接受动态
关键字?
How can I make mono accept the dynamic
keyword?
推荐答案
Hans Passant的评论解决了这个问题:
This comment of Hans Passant solved the problem:
您需要启用C#4配置文件,听起来像没有。 Google
__enable_profile4 = yes
You need to enable the C# 4 profile, sounds like you didn't. Google "__enable_profile4=yes"
这篇关于在C#中使用`dynamic`关键字不会编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!