不安全代码有什么错误?

编程入门 行业动态 更新时间:2024-10-10 06:15:32
本文介绍了不安全代码有什么错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

错误1只有在使用/unsafe C:\ Visual Studio 2010 \ Projects \ Unsafe \ Unsafe \ Program.cs进行编译时,才会出现不安全代码6 24不安全 错误2只有在使用/unsafe C:\ Visual Studio 2010 \ Projects \ Unsafe \ Unsafe \ Program.cs进行编译时,才会出现不安全代码10 31不安全

Error 1 Unsafe code may only appear if compiling with /unsafe C:\Visual Studio 2010\Projects\Unsafe\Unsafe\Program.cs 6 24 Unsafe Error 2 Unsafe code may only appear if compiling with /unsafe C:\Visual Studio 2010\Projects\Unsafe\Unsafe\Program.cs 10 31 Unsafe

using System; class Unsafe { unsafe static void SquarePtrParam(int *p) { *p *= *p; } unsafe public static void Main(string[] args) { int i = 5; SquarePtrParam(&i); Console.WriteLine(i); } }

[删除电子邮件]谢谢.

[EMAIL REMOVED] Thanks.

推荐答案

您需要在Visual Studio的编译选项中添加"/unsafe"开关. You need to add "/unsafe" switch in the compiling options in visual studio.

选择项目属性.在构建"标签中,选中复选框 允许不安全的代码".生成应用程序并运行文件. 问候, Vineeth Select the project properties. In ''Build'' tab check the checkbox ''Allow unsafe code''.Build the application and run the file. Regards, Vineeth

仍然允许不安全代码"仍然错误程序"C:\ *"不包含适用于入口点的静态"Main"方法-谢谢 ''Allow unsafe code" still error Program "C:\*" does not contain a static "Main" method suitable for an entry point - Help me, THANKS

更多推荐

不安全代码有什么错误?

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

发布评论

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

>www.elefans.com

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