C# define string format of double/floats to be US english by default
- by neil
Hi,
I have got several thousands of lines of a web application source code, initially written on a US development system, to maintain. It makes heavy use of SQL statement strings, which are combined on the fly, e.g.
string SQL = "select * from table where double_value = " + Math.Round(double_value, 2);
Don't comment on bad programming style, that doesn't help me in this case :)
The cruix: My system uses a German locale, which in turn leads to wrong SQL statements, like this:
"select * from table where double_value = 15,5"
(Note the comma as decimal separator instead of a point).
Question: What is the most "elegant" way to change the locale of the web app in this case) to US or UK in order to prevent being forced to change and inspect every single line of code? .net 3.5 is not an option (would give me the chance to overwrite ToString() in an extension class)
Kind regards