I am trying to parse string "0.0000" with double.TryParse()
but I have no idea why would it return false in this particular example. When I pass integer-like strings e.g. "5" it parses correctly to value of 5 .
Any ideas why it is happening ?
I am trying to parse string "0.0000" with double.TryParse()
but I have no idea why would it return false in this particular example. When I pass integer-like strings e.g. "5" it parses correctly to value of 5 .
Any ideas why it is happening ?
It works for me:
writes
True
.To change the culture to something that has "." as decimal separator use:
Almost certainly the problem is that
Thread.CurrentCulture
does not use dot as the decimal separator.If you know that the number will be always formatted with dot as the decimal separator, use this code that utilizes the other overload of
double.TryParse
: