-unsafe (C# Compiler Options)
The -unsafe compiler option allows code that uses the unsafe keyword to compile.
Syntax
-unsafe
Remarks
For more information about unsafe code, see Unsafe Code and Pointers.
To set this compiler option in the Visual Studio development environment
Open the project's Properties page.
Click the Build property page.
Select the Allow Unsafe Code check box.
To add this option in a csproj file
Open the .csproj file for a project, and add the following elements:
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
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
Feedback
Loading feedback...