Is it possible to convert a lambda expression like x => x + 1.5 to string using specific culture/format options? I know I can do:
Expression<Func<double,double>> expr = x => x + 1.5;
string s = expr.Body.ToString();
But with some app language settings it gives s equal to "x + 1,5" (with a comma instead of a dot). It seems that ToString() takes current culture info.
How to get back the string in its original form, culture-invariant?
There is a way to do it, but it’s really ugly… just change the current culture temporarily: