The clr will therefore only execute unsafe code if it is within a fully trusted assembly 因此, clr只對在完全受信任的程序集中的不安全代碼執(zhí)行操作。
In an unsafe code block , it is now possible to declare fixed - size structures with embedded arrays 在不安全的代碼塊中,現(xiàn)在可以聲明包含嵌入數(shù)組的固定大小結(jié)構(gòu)。
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 在某些情況下,通過移除數(shù)組界限檢查,不安全代碼可提高應(yīng)用程序的性能。
Unsafe code in c is not necessarily dangerous ; it is simply code whose safety cannot be verified by the clr C #中的不安全代碼不一定是危險的,只是其安全性無法由clr進(jìn)行驗證的代碼。
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 “編輯并繼續(xù)”不支持更改存在于包含stackalloc運算符的方法內(nèi)的不安全代碼。
If you use unsafe code , it is your responsibility to ensure that your code does not introduce security risks or pointer errors 如果使用不安全代碼,由您負(fù)責(zé)確保您的代碼不會引起安全風(fēng)險或指針錯誤。
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 當(dāng)非托管或不安全代碼試圖讀寫未分配或不具有訪問權(quán)限的內(nèi)存空間時,就會產(chǎn)生訪問沖突。