Can IntPtr be cast into a byte array without doing a Marshal.Copy?

后端 未结 4 779
小蘑菇
小蘑菇 2020-12-14 07:21

I want to get data from an IntPtr pointer into a byte array. I can use the following code to do it:

IntPtr intPtr = GetBuff();
byte[] b = new byte[length];
         


        
4条回答
  •  無奈伤痛
    2020-12-14 08:00

    Check out this Code Project page for a solution to working with unmanaged arrays.

提交回复
热议问题