这很容易创建。我有一个简单的字节数组,并证明它在运行时中包含数据:

然后我就这么做了
var bytedata = BitConverter.ToUInt32(byte_array,0);它会编译,但我在运行时得到一个Argument Exception,它表示目标数组太小。
来自microsoft msdn文档:
byte[] bytes = { 0, 0, 0, 25 };
int i = BitConverter.ToInt32(bytes, 0);发布于 2015-03-24 13:56:45
整数的大小(在C#中)是4个字节。要成功转换,至少需要4个字节。样本显示只有3种。
(不确定消息为什么写着“目标数组”。它是相当“来源”)。
https://stackoverflow.com/questions/29234479
复制相似问题