dotnet / dotnet/dotnet-api-docs
BitConverter.ToString(byte[]) states being affected by endianness - how so?
- Lingua principale
- C#
- Stelle
- 949
- Fork
- 1.7k
- Merge medio
- 2g 19h
- PR unite (30g)
- 52
Descrizione
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?
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Start with the System.BitConverter.ToString() API documentation and the referenced System.Private.CoreLib/BitConverter.cs source. Compare the documented endianness remark with the byte-array iteration shown there, then update the remark if the investigation confirms it is misleading and verify the rendered API text.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 42/100