我有这个整数(27493164),我想以这种形式将其放入字节数组:
我通过以下方法获得了该值:
string result = ((uint)total).ToString("X");
但是我不知道如何以这种形式将其插入字节数组。
答案 0 :(得分:1)
不过,我不太确定你的措辞
// int bytes
byte[] intBytes = BitConverter.GetBytes(intValue);
//bytes to hex
var hexData = intBytes.Select(b => b.ToString("X2"))
//hex to string
Console.WriteLine(string.Join(" ",hexData));