473,394 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

CurrentThread question

Hi,
I have a web service, which calls one class to do all detailed jobs. In this
class, I need to handle globalization problems by running
Thread.CurrentThread.CurrentCulture = new CultureInfo(language);
My question is, by running this, the culture changing will affect the whole
web service or only this initialized instance?

Thanks!

--
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy
Nov 16 '05 #1
3 1033

It will only affect the current thread (if it's the ASP.Net thread that is)
and it willl reset to default locale after the request is done.

So if your code changes it and then continues on you may have to reset the
locale when your component is done. This is easy though - just save the
locale id, then reset when done.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
"Hardy Wang" <ha********@marketrend.com> wrote in message
news:OD*************@TK2MSFTNGP11.phx.gbl...
Hi,
I have a web service, which calls one class to do all detailed jobs. In this class, I need to handle globalization problems by running
Thread.CurrentThread.CurrentCulture = new CultureInfo(language);
My question is, by running this, the culture changing will affect the whole web service or only this initialized instance?

Thanks!

--
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy

Nov 16 '05 #2
it only effects the current thread, which will be returned to the pool (so
be sure to restore it). if you use any of the webservice async features,
you are not guaranteed the same thread for the completed web request, so you
need to be careful.
-- bruce (sqlwork.com)

"Hardy Wang" <ha********@marketrend.com> wrote in message
news:OD*************@TK2MSFTNGP11.phx.gbl...
Hi,
I have a web service, which calls one class to do all detailed jobs. In this class, I need to handle globalization problems by running
Thread.CurrentThread.CurrentCulture = new CultureInfo(language);
My question is, by running this, the culture changing will affect the whole web service or only this initialized instance?

Thanks!

--
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy

Nov 16 '05 #3
Hardy Wang <ha********@marketrend.com> wrote:
I have a web service, which calls one class to do all detailed jobs. In this
class, I need to handle globalization problems by running
Thread.CurrentThread.CurrentCulture = new CultureInfo(language);
My question is, by running this, the culture changing will affect the whole
web service or only this initialized instance?


Others have provided an answer about the thread, but I'm concerned by
your statement that you *need* to handle globalization by changing the
current thread's culture. Which culture-sensitive methods do you need
to call which don't have an override which states which culture to use?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jesper Matthiesen | last post by:
Hey In the run method of an io-thread I saw this: while(Thread.currentThread() == thread) { ... } Where 'thread' is an instance variable. What is the purpose of this check? Regards Jesper
3
by: Stevey | last post by:
I have the following XML file... <?xml version="1.0"?> <animals> <animal> <name>Tiger</name> <questions> <question index="0">true</question> <question index="1">true</question> </questions>
7
by: nospam | last post by:
Ok, 3rd or is it the 4th time I have asked this question on Partial Types, so, since it seems to me that Partial Types is still in the design or development stages at Microsoft, I am going to ask...
1
by: Rahul Agarwal | last post by:
Hi I am trying to write data back to the client using dataset.WriteXML and I have set the Thread.CurrentThread.CurrentCulture to "no" (norwegian) just before writing the data using WriteXML....
3
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table...
3
by: Hardy Wang | last post by:
Hi, I have a web service, which calls one class to do all detailed jobs. In this class, I need to handle globalization problems by running Thread.CurrentThread.CurrentCulture = new...
5
by: Tsair | last post by:
I set the thread culture in MAIN() as below in order to show the date in format DAY/MONTH/YEAR, but the datagridview alway show the date in M/d/yyyy. How to set the default Date format from...
2
by: spig.marco | last post by:
Hi to all!, I've downloaded .net Framework SDK 2.0 and I have VB.NET2005 Express Edition, I would like to create multilanguage systems that changes with radio button. With Windows Localization...
4
by: Rainer Queck | last post by:
Hi NG, in my application a <myDataTable>.Select fails with "Syntax error in the expression." It took me a while, isolate the cause to this: To select some datarows from a data table I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.