If your desired 32-bit value is 1, it's stored as big endian.
– Joachim Isaksson
i must make reverse for array to store result as big endian=1??
– user2839704
The question doesn't make sense, bytes don't have an endian order. Only value type values of a type that requires more than a byte for storage can be affected, a byte[] is unambiguous. You only ever have an issue you try to convert the byte[] to another type with BitConverter. Given the scarcity of big-endian machines today, you'd better start with {1, 0, 0, 0} if an int value of 1 is intended.
– Hans Passant
1 Answers
0
votes
That would be in little-endian representation, as the smallest component is at the end.
You can use the BitConverter.IsLittleEndian property to dynamically find out the endianess of the system that the program is running on:
if (!BitConverter.IsLittleEndian) {
Array.Reverse(a);
}
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more
1
, it's stored as big endian. – Joachim Isaksson