what is the best way to store some variable local to each thread?
See Question&Answers more detail:oswhat is the best way to store some variable local to each thread?
See Question&Answers more detail:osIf 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.