如何在C#中编译不安全的代码 [英] how to compile unsafe code in C#

查看:66
本文介绍了如何在C#中编译不安全的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编译不安全的代码,当我编写不安全的关键字时出现错误massafe


仅当使用unsafe

how to compile unsafe code i got error massafe when i write unsafe keyword


unsafe code may only appear if comiling with unsafe

推荐答案

进行编译时,不安全代码才可能出现.当然,您需要允许不安全代码作为编译器的命令行参数.如果您在项目文件中设置了适当的标志,则MSBuild会为您执行此操作.使用Visual Studio时,请使用项目属性->中的相应复选框来执行此操作.建立-> 允许使用不安全的代码".

看,在进行认真的项目之前,最好先浏览所有的编译器/项目/Visual Studio选项和菜单.使用的平台的语言和基本原理也是如此.

—SA
Sure, you need to allow unsafe code as a command line parameter of a compiler. MSBuild does it for you if you set an appropriate flag in the project file. With Visual Studio do it using appropriate check box in the project Properties -> Build -> "Allow unsafe code".

Look, you better look through all the compiler / project / Visual Studio options and menus before getting to serious project; same goes about the language and fundamentals of the platform used.

—SA


这篇关于如何在C#中编译不安全的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆