Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Unsafe code may only appear if compiling with /unsafe
If source code contains the unsafe keyword, then the AllowUnsafeBlocks compiler option must also be used. For more information, see Unsafe Code and Pointers.
To set the unsafe option in Visual Studio 2012, click on Project in the main menu, select the Build pane, and check the box that says "allow unsafe code."
The following sample, when compiled without /unsafe, generates CS0227:
// CS0227.cs
public class MyClass
{
unsafe public static void Main() // CS0227
{
}
}