假设int mNum = 10;
我们正常用BitConverter.GetBytes((short)mNum)得到的就是小端模式的数0x0A 0x00,要想得到大端模式的数只需加上Reverse,即
BitConverter.GetBytes((short)mNum).Reverse();
就能得到mNum大端模式的数0x00 0x0A了。
C#怎么把小端模式转换成大端模式
最新推荐文章于 2024-05-11 09:04:41 发布
假设int mNum = 10;
我们正常用BitConverter.GetBytes((short)mNum)得到的就是小端模式的数0x0A 0x00,要想得到大端模式的数只需加上Reverse,即
BitConverter.GetBytes((short)mNum).Reverse();
就能得到mNum大端模式的数0x00 0x0A了。