/unsafe (C# Compiler Options)


Updated: July 20, 2015

The /unsafe compiler option allows code that uses the unsafe keyword to compile.


For more information about unsafe code, see Unsafe Code and Pointers.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Properties page.

  2. Click the Build property page.

  3. Select the Allow Unsafe Code check box.

For information about how to set this compiler option programmatically, see AllowUnsafeBlocks.

Compile in.cs for unsafe mode:

csc /unsafe in.cs  

C# Compiler Options
NIB How to: Modify Project Properties and Configuration Settings