The clr will therefore only execute unsafe code if it is within a fully trusted assembly 因此, clr只对在完全受信任的程序集中的不安全代码执行操作。
In an unsafe code block , it is now possible to declare fixed - size structures with embedded arrays 在不安全的代码块中,现在可以声明包含嵌入数组的固定大小结构。
In unsafe code , an object must be pinned before it can be referred to by an unmanaged pointer 在不安全代码中,必须先将对象固定,然后非托管指针才可引用该对象。
In some cases , unsafe code may increase an application s performance by removing array bounds checks 在某些情况下,通过移除数组界限检查,不安全代码可提高应用程序的性能。
Unsafe code in c is not necessarily dangerous ; it is simply code whose safety cannot be verified by the clr C #中的不安全代码不一定是危险的,只是其安全性无法由clr进行验证的代码。
Changes to unsafe code have the same limitations as changes to safe code , with one additional restriction 对不安全代码的更改与对安全代码的更改有相同的限制,但它还包含一条附加的限制:
Edit and continue does not support changes to unsafe code that exits within a method containing the stackalloc operator “编辑并继续”不支持更改存在于包含stackalloc运算符的方法内的不安全代码。
If you use unsafe code , it is your responsibility to ensure that your code does not introduce security risks or pointer errors 如果使用不安全代码,由您负责确保您的代码不会引起安全风险或指针错误。
Now let ' s put it all together into an easy - to - use 8bit image access class . remember to allow unsafe code blocks before compiling 先让我们把它们和在一起成为一个使用8位图像的程序片段。记住在计算之前要解除不安全代码锁定。
An access violation occurs in unmanaged or unsafe code when the code attempts to read or write to memory that has not been allocated , or to which it does not have access 当非托管或不安全代码试图读写未分配或不具有访问权限的内存空间时,就会产生访问冲突。