如何在C#中编译不安全的代码

编程入门 行业动态 更新时间:2024-10-26 10:28:12
本文介绍了如何在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#中编译不安全的代码

本文发布于:2023-07-29 10:59:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1240078.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不安全   代码   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!