Allow unsafe code in jetbrains rider?

时间:2017-08-30 20:29:26

标签: c# unsafe rider

I need to write an insert method in C# and apparently "unsafe construct cannot be used in safe context". I went to project properties and saw a switch to allow unsafe code in Debug and Release builds.

However, it is not clickable.

enter image description here

How do I allow unsafe code for my project?

Edit: adding Y = np.insert(Y, 0, ratings, axis=1) to ~/.nanorc tag in the unsafe file does fix the problem but I was wondering if there is a way to do this in the IDE itself, since I expect IDEs to be able to do these sort of stuff.

1 个答案:

答案 0 :(得分:1)

在代码中的“不安全”关键字上使用 Alt-Enter。在那里你会找到“允许对这个项目使用不安全代码”的选项。

我不知道以后如何撤消 thst。有趣的是,Rider 手册对此没有任何说明。