Compiler Error CS0227: Unsafe code may only appear if compiling with /unsafe
如果想在C# 代码中使用指针,需要在Visual Studio 中,solution exploer -> project 上右键(注意不是 solution 上右键!!!)-> build -> Allow unsafe code 勾选上
参考:Compiler Error CS0227 | Microsoft Docs
深入剖析C# 指针 - 编程宝库 (codebaoku.com)