字节序

$.字节序是指多字节数据在计算机内存中存储或者网络传输时各字节的存储顺序。

$.一个多字节数据按照其存储地址从低到高排列,如果最低有效字节在最高有效字节的前面,则称小端序;反之则称大端序。

$.因为字符串是一个字节一个字节编码的,所以不存在大小端问题。

$.注1
public static byte[] BitConverter.GetBytes(int value);

The order of bytes in the array returned by the GetBytes method depends on whether the computer
architecture is little-endian or big-endian.

$.注2
public static readonly bool BitConverter.IsLittleEndian;

This value is true if the architecture is little-endian; false if it is big-endian.

$.注3
public virtual int BinaryReader.ReadInt32();
public virutal int BinaryWriter.WriteInt32();

BinaryReader使用小端序读取数据;类似的,BinaryWriter也使用小端序写入数据。

$.参考
http://www.cnblogs.com/jeffreyzhao/archive/2010/02/10/byte-order-and-related-library.html

原文地址:https://www.cnblogs.com/codingthings/p/4326604.html