简体   繁体   中英

.NET - Copy from Unmanaged Array to Unmanaged Array

I've been looking through the Marshal class, but I can't seem to find a method that allows me to copy from an unmanaged array (IntPtr) to another unmanaged array (IntPtr).

Is this possible using .NET?

You can also DllImport RtlMoveMemory to get the job done:

[DllImport("Kernel32.dll", EntryPoint="RtlMoveMemory", SetLastError=false)]
static extern void MoveMemory(IntPtr dest, IntPtr src, int size);

This will also require FullTrust, however, but as you are working with unmanaged code, I'd expect you already have it.

您可以恢复使用C#中的不安全代码 (如果这是一个选项)(通常需要FullTrust权限,可能并非在所有情况下都可用)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM