I have a method that must use unsafe code to run.
private unsafe void myMethod()
when I compile (in Windows Application) there's an error say that "Unsafe code may only appear if compiling with /unsafe"
How can I fix the error?
Thank you and regards,

1 answers
It means the compiler needs the flag that says "unsafe code can be used here".
There should be an option within your projects properties to toggle this flag (though I'm not exactly sure where it is at off the top of my head).
answered 2 years ago by:
0
you will find an option in the project properties under build (as i remember) called (enable unsafe blocks) or something like that make this option true and rebuild
answered 2 years ago by:
0
Hi
If you are using VS.NET, do the following:
Step 1: Go to Solution Explorer
Step 2: Right Click Project and Select Properties
Step3: Choose Configuration Properties -> Build
Step 4: Set Allow unsafe Code blocks is true
Step5: Click OK.
Now you can compile the program.
_Vipins
answered 2 years ago by:
0
Thank you very much, it worked.
answered 2 years ago by:
0
Thank you for your help
answered 2 years ago by:
0
This post was imported from csharpfriends, if you have a similiar question please ask it again.
All previous members have been migrated, hope you enjoy the new platform!