I'm trying to convert a string into double, I've this value:
string doub = "53.095";
var cv = Convert.ToDouble(doub);
I guess it's because different countries handle comma differently. My country, for example uses
, instead. So you must be aware of how the string is formatted.
string doub = "53.095"; var cv = double.Parse(doub, new CultureInfo("en-GB"));
For another localization this will work.
string doub = "53,095"; // note , var cv = double.Parse(doub, new CultureInfo("sv-SE"));
[...] it is associated with the English language but not with any country/region.
string doub = "53.095"; string doub2 = "53,095"; var cv1 = double.Parse(doub, CultureInfo.InvariantCulture); // Works var cv2 = double.Parse(doub2, CultureInfo.InvariantCulture); // Does not work.