By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,234 Members | 1,908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,234 IT Pros & Developers. It's quick & easy.

CultureInfo

P: n/a
Hi

I've been taken by surprise when I realized that MyDouble.ToString()
actually formats the string based on the local settings of the machine it
was installed on (rather than using InvariantCulture settings by default).
This represents a problem for my app, since this data is converted back to
doubles at some later stage and since the client and the server may have
different regional settngs.

Is there a way to set the culture in an application 'globally', rather the
using MyDouble.ToString(System.Globalization.CultureInfo .InvariantCulture)
all over the place?

Thanks for any hints.

Urs
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Urs,
You can set System.Threading.Thread.CurrentThread.CurrentCultu re to the
culture that you want, ToString will then use that.

For an example see:
http://msdn.microsoft.com/library/de...matstrings.asp

You may also want to review System.Globalization.CultureInfo for properties
& methods to get a possibly more granular change...

Hope this helps
Jay

"Urs Vogel" <uv****@msn.com> wrote in message
news:Og**************@TK2MSFTNGP09.phx.gbl...
Hi

I've been taken by surprise when I realized that MyDouble.ToString()
actually formats the string based on the local settings of the machine it
was installed on (rather than using InvariantCulture settings by default).
This represents a problem for my app, since this data is converted back to
doubles at some later stage and since the client and the server may have
different regional settngs.

Is there a way to set the culture in an application 'globally', rather the
using MyDouble.ToString(System.Globalization.CultureInfo .InvariantCulture)
all over the place?

Thanks for any hints.

Urs

Nov 20 '05 #2

P: n/a
Jay

Wasn't aware of thread related culture settings. The current thread works
fine for me, and since I use the thread pool with very few generic API
methods, it's fairly easy to control.

Thanks, Urs.
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> schrieb im
Newsbeitrag news:uT*************@TK2MSFTNGP11.phx.gbl...
Urs,
You can set System.Threading.Thread.CurrentThread.CurrentCultu re to the
culture that you want, ToString will then use that.

For an example see:
http://msdn.microsoft.com/library/de...matstrings.asp
You may also want to review System.Globalization.CultureInfo for properties & methods to get a possibly more granular change...

Hope this helps
Jay

"Urs Vogel" <uv****@msn.com> wrote in message
news:Og**************@TK2MSFTNGP09.phx.gbl...
Hi

I've been taken by surprise when I realized that MyDouble.ToString()
actually formats the string based on the local settings of the machine it was installed on (rather than using InvariantCulture settings by default). This represents a problem for my app, since this data is converted back to doubles at some later stage and since the client and the server may have
different regional settngs.

Is there a way to set the culture in an application 'globally', rather the using MyDouble.ToString(System.Globalization.CultureInfo .InvariantCulture) all over the place?

Thanks for any hints.

Urs


Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.