Im working on a multithreaded application, therefore, I was always trying not to use private fields that may raise a conflict in the type instance i was using in different threads. Instead, I have been hauling information i needed to work as method parameters. This led to dozens of methods that all declared the same parameters:
private void MySubmethod(MyConfiguration configuration)
Now i was thinking to redesign the type and creating one instance per thread working, but then i stumbled upon the ThreadStatic attribute.
Is it a good idea to just declare a private threadstatic field, initialize it inside the main method each thread is calling and reuse this field inside all sub-methods, rendering the parameter obsolete? Or has it any drawbacks, so that i rather should concentrate on creating a new instance per Thread?
[ThreadStatic]
private static MyConfiguration _configuration;