返回值是怎么算出来的?
byte[] byted={1,2,3,38,21,0};
int data=BitConverter.UInt16(bytes,4);//输出为21
data=BitConverter.UInt16(bytes,3);//输出为5414, 我的理解是38
返回值是怎么算出来的?
byte[] byted={1,2,3,38,21,0};
int data=BitConverter.UInt16(bytes,4);//输出为21
data=BitConverter.UInt16(bytes,3);//输出为5414, 我的理解是38
toUInt16是把指定位置的两个字节转成16bit无符号整数 又因为计算机一般是小端模式存储
21 -> byted[4]+byted[5]*2^8
5414 -> byted[3]+byted[4]2^8 = 38+21256