Question Thread- Local Storage

christopher3683

New member
Joined
Aug 13, 2013
Messages
4
Programming Experience
5-10
Hi Team,
I have Task in Threading, The Scenario is:
i have a multiple threads and they are returning a value. i have to store each thread returned value, once all the thread is completed. finally i consolidated it store all thread value and make single string.
for that i'm using "Thread- Local Storage" concept. But i'm unable to achieve through coding,
Please suggest me is there any other concepts available or the above concepts are good to go
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
4,919
Location
Sydney, Australia
Programming Experience
10+
First of all, threads don't return anything. Methods can return something and methods are executed on a thread but threads themselves don't return anything.

Secondly, the whole point of thread local storage is that it's storage local to a thread. If you want to combine all the data into a single string then obviously more than one thread has to be able to see the data, so thread local storage is of no use to you. Just use a List<string> or the like.
 
Top Bottom