C# how to get Byte[] from IntPtr
If it’s a byte[] array: byte[] managedArray = new byte[size]; Marshal.Copy(pnt, managedArray, 0, size); If it’s not byte[], the size parameter in of Marshal.Copy is the number of elements in the array, not the byte size. So, if you had an int[] array rather than a byte[] array, you would have to divide by 4 …