https://www.cnblogs.com/Jasmine-K/p/7659908.html
使用 BinaryPrimitives 辅助转换
获取了byte[] bufferSpan的内容,接下来就可以调用 BinaryPrimitives 静态类提供的方法进行转换
uint value = BinaryPrimitives.ReadUInt32BigEndian(bufferSpan);
使用数组反转的方式转换
public byte[] Big2Little(List<uint> bufferlist)
{
if (bufferlist == null || bufferlist.Count <= 0)
{
return null;
}
uint[] buffers = bufferlist.ToArray();
for(int i=0;i< buffers.Length; i++)
{
buffers[i] = BitConverter.ToUInt32(BitConverter.GetBytes(buffers[i]).ToArray(), 0);
}
byte[] datas = new byte[buffers.Length * 4];
Buffer.BlockCopy(buffers, 0, datas, 0, buffers.Length * 4);
return datas;
}
标签:转换,C#,bufferlist,bufferSpan,BinaryPrimitives,大小,byte
From: https://www.cnblogs.com/sai-123/p/18439366