如何在C#中编译不安全的代码

Tho*_*eld 5 c# winapi winforms

我已经导入了一个API函数

[DllImport("gdi32.dll")]
private unsafe static extern bool SetDeviceGammaRamp(Int32 hdc, void* ramp);
Run Code Online (Sandbox Code Playgroud)

同时编译它显示的错误就像

Unsafe code may only appear if compiling with /unsafe
Run Code Online (Sandbox Code Playgroud)

如何编译/unsafe.我正在使用Microsoft Visual Studio 2008

任何人都可以帮助我找到更好的解决方案.

提前致谢.

Cat*_*rea 13

右键单击项目.属性.建立.检查允许不安全的代码