Click here to Skip to main content
15,920,956 members
Home / Discussions / C#
   

C#

 
QuestionIs This Method Thread Safe ? Pin
X20402-Jun-10 3:32
X20402-Jun-10 3:32 
AnswerRe: Is This Method Thread Safe ? [modified] Pin
Anthony Mushrow2-Jun-10 4:02
professionalAnthony Mushrow2-Jun-10 4:02 
GeneralRe: Is This Method Thread Safe ? Pin
Luc Pattyn2-Jun-10 5:10
sitebuilderLuc Pattyn2-Jun-10 5:10 
GeneralRe: Is This Method Thread Safe ? Pin
Anthony Mushrow2-Jun-10 5:17
professionalAnthony Mushrow2-Jun-10 5:17 
GeneralRe: Is This Method Thread Safe ? Pin
Luc Pattyn2-Jun-10 5:39
sitebuilderLuc Pattyn2-Jun-10 5:39 
GeneralRe: Is This Method Thread Safe ? Pin
Anthony Mushrow2-Jun-10 7:03
professionalAnthony Mushrow2-Jun-10 7:03 
AnswerRe: Is This Method Thread Safe ? Pin
Luc Pattyn2-Jun-10 4:06
sitebuilderLuc Pattyn2-Jun-10 4:06 
AnswerRe: Is This Method Thread Safe ? Pin
Pete O'Hanlon2-Jun-10 4:07
mvePete O'Hanlon2-Jun-10 4:07 
As you aren't operating on a member variable in this example, and you have a nice self contained method where you have immutable data, this is perfectly thread safe. In other words, there is no chance that another thread can change the value of xml or item and affect the outcome.

Suppose that you changed it so that xml was a member property of type XMLElement, and you passed item in - then you could have a none thread-safe method because you could affect XMLElement before you actually performed the operation on the XML.

"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.


My blog | My articles | MoXAML PowerToys | Onyx



AnswerRe: Is This Method Thread Safe ? Pin
harold aptroot2-Jun-10 5:41
harold aptroot2-Jun-10 5:41 
GeneralRe: Is This Method Thread Safe ? Pin
X20406-Jun-10 1:10
X20406-Jun-10 1:10 
GeneralRe: Is This Method Thread Safe ? Pin
harold aptroot6-Jun-10 9:15
harold aptroot6-Jun-10 9:15 
QuestionAnything qucker than Image.FromStream Pin
TimSWatson2-Jun-10 3:11
TimSWatson2-Jun-10 3:11 
AnswerRe: Anything qucker than Image.FromStream Pin
Anthony Mushrow2-Jun-10 3:20
professionalAnthony Mushrow2-Jun-10 3:20 
GeneralRe: Anything qucker than Image.FromStream Pin
TimSWatson2-Jun-10 3:36
TimSWatson2-Jun-10 3:36 
GeneralRe: Anything qucker than Image.FromStream Pin
Anthony Mushrow2-Jun-10 3:59
professionalAnthony Mushrow2-Jun-10 3:59 
GeneralRe: Anything qucker than Image.FromStream Pin
TimSWatson2-Jun-10 4:08
TimSWatson2-Jun-10 4:08 
GeneralRe: Anything qucker than Image.FromStream Pin
Anthony Mushrow2-Jun-10 4:24
professionalAnthony Mushrow2-Jun-10 4:24 
GeneralRe: Anything qucker than Image.FromStream Pin
TimSWatson2-Jun-10 4:39
TimSWatson2-Jun-10 4:39 
QuestionUse a folder of XML files as a datasource for nhibernate Pin
Bart Van Eyndhoven2-Jun-10 2:38
Bart Van Eyndhoven2-Jun-10 2:38 
Questioncreate object for a dll and get the methods Pin
arun_pk2-Jun-10 2:32
arun_pk2-Jun-10 2:32 
AnswerRe: create object for a dll and get the methods Pin
Ravi Bhavnani2-Jun-10 2:50
professionalRavi Bhavnani2-Jun-10 2:50 
Questioncarriage return Pin
genieabdo2-Jun-10 0:39
genieabdo2-Jun-10 0:39 
AnswerRe: carriage return [modified] Pin
Pete O'Hanlon2-Jun-10 0:41
mvePete O'Hanlon2-Jun-10 0:41 
GeneralRe: carriage return Pin
harold aptroot2-Jun-10 1:06
harold aptroot2-Jun-10 1:06 
GeneralRe: carriage return Pin
Pete O'Hanlon2-Jun-10 1:59
mvePete O'Hanlon2-Jun-10 1:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.