Cannot use unsafe construct in safe context

https://*.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.

 

无法使用unsafe,需要在项目属性里打开。

测试了一下IntPtr的大小是4字节

https://www.cnblogs.com/darrenji/p/3976029.html

 public void TestChuck()
        {
            unsafe
            {

                Console.WriteLine(sizeof(IntPtr));
            }
        }

 

上一篇:MySQL命令总结--启动,停止,重启


下一篇:转载:mysql sql_safe_updates 分析