https://stackoverflow.com/questions/25953887/how-to-use-unsafe-code-in-safe-contex
I am not sure if you need unsafe code in that case (see answer of @mybirthname).
But when unsafe code is needed, it can be enabled in Project properties.
- In the main menu, click
Project
and then<ProjectName> properties...
- Click on the
Build
page. - Select
Allow unsafe code
.
Or one can specify /unsafe compiler option explicitly.
Can not use unsafe, you need to open the project properties in.
Test it IntPtr size is 4 bytes
https://www.cnblogs.com/darrenji/p/3976029.html
public void TestChuck() { unsafe { Console.WriteLine(sizeof(IntPtr)); } }