Unsafe code may only appear if compiling with /unsafe
2010-10-18
When you add a old C++ method in your C# code, you might get the following error when you attempt to build your project:
Unsafe code may only appear if compiling with /unsafe
The resolution is:
1: If you are using command line to compile, just include the /unsafe switch followed the compile command;
2: If you are using Visual studio, go to the property interface of your project, under Build tab, check on the 'Allow unsafe code' check box, see below:
