在我的语言环境中,小数点分隔符是','。C#将字符串转换为双重语言环境
但是我仍然想编写一个C#应用程序,它可以与使用'。'的数字一起工作。作为小数分隔符。
string b = "0,5";
double db = double.Parse(b); // gives 0.5
string a = "0.5";
double da = double.Parse(a); // gives 5, however i would like to get 0.5
可能的重复http://stackoverflow.com/questions/1354924/c-how-do-i-parse-a-string-with-a-decimal-point-to-a-double –
http:// stackoverflow .com/questions/2583362/how-to-convert-string-to-double-with-proper-cultureinfo 看这里 – Borgleader