I’m trying to convert a string to a double value but it’s not returning me what I expect…
double dbl; Double.TryParse('20.0', out dbl);
That piece of code is returning 200.0 (instead of 20.0) as a double value. Any idea why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should pass
InvariantCultureto the method.The reason behind this is that your regional settings probably set
.as separator character and not decimal point.