string s = "123.2";
 
            //方法1
            float f1 = Convert.ToSingle(s);
 
            //方法2
            float f2;
            if (!float.TryParse(s, out f2))
            {
                Console.WriteLine("无法转换!");
            } 

 

float volume = 0.5F; //double 转float

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2022-02-23
猜你喜欢
  • 2021-05-30
  • 2022-12-23
  • 2021-11-22
  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2021-05-20
相关资源
相似解决方案