Convert.ToDouble ("1.3") returns 13

What's going on here?

Convert.ToDouble("1.3")

I have a line with a value of "1.3". When I convert to double, it returns 13. I want to return 1.3.

+4
source share
1 answer

This is probably due to your current culture, it uses a different decimal separator character than .. You can do this instead:

double.Parse("1.3", CultureInfo.InvariantCulture);
+11
source

Source: https://habr.com/ru/post/1538311/


All Articles