❔ Culture based Type Conversions
Hello,
There is a problem in my wpf app, while convertring types using Convert class we have to define IFormatProvider at every method, is there a way to set CultureInfo to CultureInfo.InvariantCulture as default, there is too much type conversions in the project and it's so hard to add every conversions to this parameter.
18 Replies
Don't use convert, and it's not hard.
it's not hard? its not school project, there is thousands conversion
And?
so its not easy
I don't see the problem
there is might be a option manipulate program's default culture that will solve problem
what are u trying to convert anyway?
I don't see that as a "solution" personally
double to string, string to double
then what's your solution = new CultureInfo("en-US"); that's might help to me
No shot you're using
Convert
to convert a number to a string
Absolutely zero wayyeah use
.ToString()
and double.Parse
methodsi can think that, but its too hard to change every method
or double.TryParse if you want to validate the number
Your entire project is already completely messed up. At this point, i guess you can use some weird hack
i meant that, maybe there is a easy solution
yeah i mean it
It's hard to believe that you even successfully wrote a thousand lines of code while using
Convert
It can't be that muchi didn't wrote, its legacy project
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.