dotnet / dotnet/dotnet-api-docs
BitConverter.ToString(byte[]) states being affected by endianness - how so?
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
The remarks of [`System.BitConverter.ToString()`](https://docs.microsoft.com/en-us/dotnet/api/system.bitconverter.tostring) state for all overloads of the method:
> All the elements of `value` are converted. The order of hexadecimal strings returned by the [ToString](https://docs.microsoft.com/en-us/dotnet/api/system.bitconverter.tostring) method depends on whether the computer architecture is little-endian or big-endian.
I don't understand how endianness can affect the outcome, since the [reference source](https://source.dot.net/#System.Private.CoreLib/BitConverter.cs,654) iterates over each element in the input byte array in order, then operates on them as single bytes, and converts each to its hexadecimal representation (interlaced with hyphens).
Where does endianness come into effect here, or is this remark incorrect / misleading?
Contributor guide
Assessment
This issue has not been assessed yet.