what is the best way to store some variable local to each thread?
If you use .Net 4.0 or above, as far as I know, the recommended way is to use System.Threading.ThreadLocal<T> which also gives lazy initialization as a bonus.
System.Threading.ThreadLocal<T>
1.4m articles
1.4m replys
5 comments
57.0k users