There is no built-in conversion function for this. Due to how the arrays work, it will be necessary to allocate a whole new array and fill in its values. You probably just have to write it yourself. You can use the System.BitConverter.GetBytes(uint) function to do some of the work, and then copy the resulting values ββto the final byte[] .
Here is the function that will do the conversion in little-endian format:
private static byte[] ConvertUInt32ArrayToByteArray(uint[] value) { const int bytesPerUInt32 = 4; byte[] result = new byte[value.Length * bytesPerUInt32]; for (int index = 0; index < value.Length; index++) { byte[] partialResult = System.BitConverter.GetBytes(value[index]); for (int indexTwo = 0; indexTwo < partialResult.Length; indexTwo++) result[index * bytesPerUInt32 + indexTwo] = partialResult[indexTwo]; } return result; }
source share