Pass Parameters through ParameterizedThreadStart

lazyberezovsky has the right answer. I want to note that technically you can pass an arbitrary number of arguments using lambda expression due to variable capture:

var thread = new Thread(
       () => DoMethod(a, b, c));
thread.Start();

This is a handy way of calling methods that don’t fit the ThreadStart or ParameterizedThreadStart delegate, but be careful that you can easily cause a data race if you change the arguments in the parent thread after passing them to the child thread’s code.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)