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