.NET - copying from an unmanaged array to an unmanaged array

I was looking at the marshal's class, but I cannot find a way that allows me to copy from an unmanaged array (IntPtr) to another unmanaged array (IntPtr).

Is this possible with .NET?

+6
arrays copy unmanaged
source share
2 answers

You can also run DllImport RtlMoveMemory to complete the task:

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

It will also require FullTrust, however, since you are working with unmanaged code, I would expect that you already have it.

+4
source share

You can return to using unsafe C # code if this is an option (usually FullTrust permission is required, which may not be available in all cases).

-one
source share

All Articles