核心类:BitConverter
例子:
double a = BitConverter.Int64BitsToDouble (2342354);
Debug.Log (a);//1.15727664179883E-317BitConverter类还有以下几个函数:
BitConverter.ToBoolean ();
BitConverter.ToChar ();
BitConverter.ToDouble ();
BitConverter.ToInt16 ();
BitConverter.ToInt32 ();
BitConverter.ToInt64 ();
BitConverter.ToSingle ();
BitConverter.ToString ();
BitConverter.ToUInt16 ();
BitConverter.ToUInt32 ();
BitConverter.ToUInt64 ();这些函数都接收一个byte[]参数,然后返回对应类型的值。
本文详细介绍了BitConverter类在C#编程中的使用,包括如何将整数转换为双精度浮点数,以及该类提供的其他常用转换函数。通过实例演示了如何灵活运用这些函数进行不同类型数据之间的转换。
337

被折叠的 条评论
为什么被折叠?



