This post is about C# and .Net, but some info is valuable for other techonolgies.
Since I can remember, I\'ve been having problems with apps or games that c
There is really no other way to resolve this issue, just fix it in the code.
If you care to run FxCop you would soon learn to always pass valid CultureInfo to every possible ToString()
or Parse()
method. Frankly, this is the way it should be done, even when you know that CultureInfo.CurrentCulture
is used by default.
By always passing IFormatProvider, you are telling other developers:
ToString(CultureInfo.CurrentCulture)
or Parse(whatever, CultureInfo.CurrentCulture)
- this is something end user will see or will be able to enter, so we need to care about his/her cultural background.ToString(CultureInfo.InvariantCulture)
or Parse(whatever, CultureInfo.InvariantCulture)
- this is something we use internally and it is not meant to be shown to user.Now, I know it sounds like a lot of work but this is simply something that needs to be done. You might just want to thank some poor soul in Microsoft, who with his/her good intention decided that end user's CurrentCulture is the best default for formatting providers... Obviously, other framework designers who did this in the past were wrong and folks from MS are right, ha? A lot of cash has evaporated because of this stupid, unfixable mistake.