byte

将int[]转换为byte[]
.NET

将int[]转换为byte[]

647 0

将int[]转换为byte[]:public static unsafe byte[] IntArrToByteArr(int[] intArr){byte[] bytArr = new byte[sizeof(int) * intArr.Length];//使用int指针指向int数组,强制转换为byte指针,逐个元素赋值给byte数组即可。 fixed (int* pInt = intArr){byte* pByte = (byte*…