So I'm currently using the following code to parse a string into a double:
double.TryParse(resultLabel.Content.ToString(), out newNumber);
The parsing is executed but it ignores the . in the code. For Example:
Does anyone know why is that and how to fix it?
Thanks in advance!
I tried to track it down with break points where it it parses falsely and it was immediately after this line.
You need to pass culture that use "." as decimal separator (e.g. InvariantCulture)
var resultLabel = "3.3";
var success = double.TryParse(resultLabel, out var newNumber); //success is false
success = double.TryParse(resultLabel, NumberStyles.Any, CultureInfo.InvariantCulture, out newNumber); //success is true