Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Error CS0227
Collapse the table of content
Expand the table of content

Compiler Error CS0227 

Error Message

Unsafe code may only appear if compiling with /unsafe

If source code contains the unsafe keyword, then the /unsafe compiler option must also be used. For more information, see Unsafe Code and Pointers (C# Programming Guide).

The following sample, when compiled without /unsafe, will generate CS0227:

// CS0227.cs
public class MyClass
   unsafe public static void Main()   // CS0227

Community Additions

© 2015 Microsoft