I'm trying to convert this string to double
Convert.ToDouble("1.12");
and this is the output
System.FormatException was unhandled.
Should I do something like this?
public static double ConvertToDouble(string ParseVersion)
{
double NewestVersion;
try
{
NewestVersion = Convert.ToDouble(ParseVersion);
}
catch
{
ParseVersion = ParseVersion.Replace('.', ',');
NewestVersion = Convert.ToDouble(ParseVersion);
}
return NewestVersion;
}
ConvertToDouble("1.12");
Or is there an easier solution?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…