Hi,
I have an console application (that also is run as a service when deployed). I'm reading values that originates from a text file. The problem is that I can't get the decimal values to work properly.
They are formatted in a "swedish way", like this 3,4
which in "english" formatting is 3.4
.
When I use:
Decimal.TryParse(value, NumberStyles.Number, new CultureInfo("sv"), out result);
I get a
Culture 'sv' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture.
exception.
If I try:
Decimal.TryParse(value, out result);
The value gets trucated (3,4 becomes 3).
Is there a way to read these formatted values (which can be integers also) in a robust and safe way, regardless of the settings in the operating system.