string str = "0.82"; //方法1 float f1 = Convert.ToSingle(str); //方法2 float f2; if (!float.TryParse(str, out f2)) { Console.WriteLine("转换错误!"); }
float threshold= 0.82f; //double 转float
string str = "0.82"; //方法1 float f1 = Convert.ToSingle(str); //方法2 float f2; if (!float.TryParse(str, out f2)) { Console.WriteLine("转换错误!"); }
float threshold= 0.82f; //double 转float