I am writing a console application in C# which makes heavy use of string comparisons as well as formatting and parsing of numbers, which are read from and written to text files.
Ideally the program should behave exactly the same on every computer, however after testing it on a computer with a different locale I realized that mentioned functionality in C# automatically uses the format of the current locale. This is unfortunate since the locale of the system leads to changes in behaviour of my program and even to program crashes (i.e. when parsing numbers with the wrong - system specific - decimal separator).
I'm looking for a way to tell the compiler/program to ignore the current locale program-wide and use the default/english one instead.
I've seen mentioned solutions which can change the default locale for a thread.
I'm not sure how that works out with using linq, parallel foreach etc. so ideally I'd just like to set the english/default locale for the entire program to avoid any accidents. How can I do that?