本文介绍了.NET - 从非托管数组非托管数组复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在寻找通过Marshal类,但我似乎无法找到一种方法,让我从一个非托管阵列(IntPtr的)复制到其他非托管阵列(IntPtr的)。
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).
这是使用.NET可能吗?
Is this possible using .NET?
推荐答案
您还可以的DllImport RtlMoveMemory来完成这项工作:
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);
这也将需要FullTrust的,但是,但是当你正在使用非托管code,我希望你已经拥有了它。
This will also require FullTrust, however, but as you are working with unmanaged code, I'd expect you already have it.
这篇关于.NET - 从非托管数组非托管数组复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!