为什么我会收到错误“只有在使用/unsafe 编译时才会出现不安全的代码"? [英] Why do I get the error "Unsafe code may only appear if compiling with /unsafe"?

查看:31
本文介绍了为什么我会收到错误“只有在使用/unsafe 编译时才会出现不安全的代码"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么会出现以下错误?

Why do I get the following error?

只有使用/unsafe 编译时才会出现不安全的代码?

Unsafe code may only appear if compiling with /unsafe"?

我使用 C# 和 Visual Studio 2008 在 Windows CE 上进行编程.

I work in C# and Visual Studio 2008 for programming on Windows CE.

推荐答案

要使用不安全的代码块,必须在打开/unsafe 开关的情况下编译项目.

To use unsafe code blocks, the project has to be compiled with the /unsafe switch on.

打开项目的属性,转到Build 选项卡并选中Allow unsafe code 复选框.

Open the properties for the project, go to the Build tab and check the Allow unsafe code checkbox.

这篇关于为什么我会收到错误“只有在使用/unsafe 编译时才会出现不安全的代码"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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