且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

包含十六进制值到十进制值的字节数组转换

更新时间:2023-11-09 13:23:52

BitConverter.ToInt32 方法是做到这一点的好办法

The BitConverter.ToInt32 method is a good way to do this

if (BitConverter.IsLittleEndian)
    Array.Reverse(array); //need the bytes in the reverse order
int value = BitConverter.ToInt32(array, 0);