如果您使用指针(不安全code)在C#中?

编程入门 行业动态 更新时间:2024-10-28 02:21:06
本文介绍了如果您使用指针(不安全code)在C#中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果您在C#code使用指针?有什么好处?难道是建议由男方(微软)?

Should you use pointers in your C# code? What are the benefits? Is it recommend by The Man (Microsoft)?

推荐答案

从人自己:

的指针的使用很少需要在C#,但也有一些情况,需要它们。作为例子,使用不安全的上下文,以允许指针是由下列情况下保证:

The use of pointers is rarely required in C#, but there are some situations that require them. As examples, using an unsafe context to allow pointers is warranted by the following cases:

  • 在现有的结构上盘交易
  • 涉及的指针结构在其中高级COM或平台调用场景
  • 在性能关键code

在其他情况下,使用不安全的情况下不鼓励。

The use of unsafe context in other situations is discouraged.

具体而言,不安全的情况下不应该被用来尝试写C code在C#。

注意:

code。使用不安全的上下文无法验证是安全的编写,因此它仅被执行时,code是完全可信的。换句话说,不安全code不能在不受信任的环境中执行。例如,你不能直接从互联网上运行不安全的code。

Code written using an unsafe context cannot be verified to be safe, so it will be executed only when the code is fully trusted. In other words, unsafe code cannot be executed in an untrusted environment. For example, you cannot run unsafe code directly from the Internet.

参考

更多推荐

如果您使用指针(不安全code)在C#中?

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

发布评论

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

>www.elefans.com

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