美文网首页
C#字节byte数组与bool/int/double/char等

C#字节byte数组与bool/int/double/char等

作者: 堆石成山 | 来源:发表于2021-04-25 19:22 被阅读0次
//bool
byte[] boolArray = BitConverter.GetBytes(true);
bool boolValue = BitConverter.ToBoolean(boolArray,0);

//double
byte[] doubleArray = BitConverter.GetBytes(-20.3);
double doubleValue = BitConverter.ToDouble(doubleArray,0);

其余类似。

相关文章

网友评论

      本文标题:C#字节byte数组与bool/int/double/char等

      本文链接:https://www.haomeiwen.com/subject/ugcjrltx.html