passing parameters to a thread
- by assassin
I want to pass a function that takes a parameter to the ThreadStart Constructor in C#. But, it seems that this is not possible, as I get a syntax error it I try to do something like this
Thread t1 = new Thread(new Thread Start(func1(obj1));
where obj1 is an object of type List<string> (say).
If I want a thread to execute this function that takes in an object as a parameter, and I plan to create 2 such threads simultaneously with different parameter values what is the best method to achieve this?