I need to write an unsafe
method in C# and apparently "unsafe construct cannot be used in safe context". I went to project properties and saw a switch to allow unsafe code in Debug and Release builds.
However, it is not clickable.
How do I allow unsafe code for my project?
Edit: adding <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
to PropertyGroup
tag in the csproj
file does fix the problem but I was wondering if there is a way to do this in the IDE itself, since I expect IDEs to be able to do these sort of stuff.