so I am using a code like this:
Double.TryParse(Value, NumberStyles.Any, CultureInfo.InvariantCulture, out result);
and for now the language is on French but some clients may use other languages too, so I am not gonna hard code "fr-FR" in the program...but now if I pass "2,00" which should be number two, it is converting it to number two hundred.
any help on how can I do this correctly? thanks
You can get the current culture for the system using CultureInfo.CurrentCulture
. Use this instead of InvariantCulture
.
If this is a web application, you can look for the Accept-Language
header in the request as a hint for which locale to use for the user.
You can use the CurrentCulture property.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With