Using `dynamic` keyword in C# doesn't compile

元气小坏坏 提交于 2019-12-07 14:03:08

问题


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?

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?


回答1:


This comment of Hans Passant solved the problem:

You need to enable the C# 4 profile, sounds like you didn't. Google "__enable_profile4=yes"



来源:https://stackoverflow.com/questions/18944208/using-dynamic-keyword-in-c-sharp-doesnt-compile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!