Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Can I pass more than one data into my target method when using ThreadPool?

use ThreadPool.QueueUserWorkItem (WaitCallback, Object) to start a thread with my target method and data. Can I pass more than one data into my method? the second parameter in QueueUserWorkItem (WaitCallback, Object) can be an array?

like image 523
5YrsLaterDBA Avatar asked Feb 19 '10 14:02

5YrsLaterDBA


1 Answers

The second parameter can be an array but you're better off creating a custom class for containing your data. That way the data you pass is fully typed.

like image 106
Samuel Neff Avatar answered Sep 27 '22 22:09

Samuel Neff