/unsafe (Enable Unsafe Mode) (C#)

Switch View :
ScriptFree
C# Language Reference 
/unsafe (Enable Unsafe Mode) (C# Compiler Options) 

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


/unsafe
Remarks

For more information about unsafe code, see Unsafe Code and Pointers (C# Programming Guide).

To set this compiler option in the Visual Studio development environment

  1. Open the project's Properties page. For details, see How to: Set Project Properties (C#, J#).

  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.

Example

Compile in.cs for unsafe mode:

csc /unsafe in.cs
See Also

Other Resources

C# Compiler Options

Community Content

vahidalizade
Is this option also for websites?
This option is not available in website's properties page.