473,386 Members | 1,743 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,386 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 18 '05 #1
3 1063

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 18 '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 18 '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 18 '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...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.