byte[] TestBytes = {0x0A,0x17,0x6A,0x44}; 
转化为浮点型? 小弟不知道怎么转化,请教大家了

解决方案 »

  1.   

    using System.BitConverter's ToDouble method, for example
    double d = BitConverter.ToDouble(TestBytes, 0);
      

  2.   

    Convert.ToDouble()
    可以转化单个的
      

  3.   

    double TestNum;
                byte[] TestBytes = {0x0A,0x17,0x6A,0x44};
                TestNum = System.BitConverter.ToDouble(TestBytes,0);
    错误提示:
    Destination array is not long enough to copy all the items in the collection. Check array index and length.
    ??????
      

  4.   

    BitConverter.ToDouble 方法 [C#]
    返回由字节数组中指定位置的八个字节转换来的双精度浮点数。是不是因为TestBytes不足8位
      

  5.   

    返回由字节数组中指定位置的八个字节转换来的双精度浮点数。
    请看MSDN
      

  6.   

    if it is not 双精度浮点数, then try BitConverter.ToSingle Method
      

  7.   

    float TestNum;
                byte[] TestBytes = { 0x0A, 0x17, 0x6A, 0x44 };
                TestNum = System.BitConverter.ToSingle(TestBytes, 0);谢谢各位! 解决