I have a code that was originally written for the English market, where the decimal separator is "." . therefore, it expects numeric values as strings to use "." as a separator. But now we have users in other places, for example, in Europe, where the decimal separator is ",".
So, in the context of my software (really only the current thread) I want to redefine the decimal separator for the current language as "." even if it uses something else by default.
I tried
String sep = "."; NumberFormatInfo nfi1 = NumberFormatInfo.CurrentInfo; nfi1.NumberDecimalSeparator = sep;
But I get the exception " Instance is only-only " in the third line. NumberFormatInfo is apparently not writable. So how do you set an existing decimal separator in a language other than its default value?
c # localization
user316117
source share