oxfc 是否定的,但我认为 byte 其值为 252 ,有没有办法将其转换为签名 字节 或 int ?
oxfc
byte
字节
int
我找到了这个方法:
(BitConverter.ToInt16(new byte[2] { 0, 0xfc }, 0) / 256).ToString()
但还有更好的方法吗?
您可以简单地将其投射:
byte b = 0xfc; sbyte s = unchecked((sbyte)b);