views:

33

answers:

2

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?

A: 

You can revert to using unsafe code in C#, if that is an option (typically requires FullTrust permission, which may not be available in all cases).

Lucero
+2  A: 

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.

codekaizen