//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);
其余类似。
//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
网友评论