Hi all,
I have a method that needs to execute a lot of times. I want to drop my code in there but also the method expects two paramaters for everything to work as expected. No I am faced with the following issue.
I use the System.Threading.ThreadPool class to queue the executions. My current code looks like this:
foreach (string f in FileList)
{
bool u = true;
ThreadPool.QueueUserWorkItem(new WaitCallback(CreateK2_Excist), f );
I want to be able to pass in u and f but I can only get the WaitCallback to accept 1 paramater.
How would it be possible to pass in two paramaters too my method??
Thanks in advance!
{SpGh}
Loading
Sam HobbsPosted Feb 23, 2010, 11:01 PM
Space GhostPosted Feb 23, 2010, 4:23 PM
ThreadPool.QueueUserWorkItem(new WaitCallback(Create_Excist), (object)new object[] { f, u });
...
...
...
public void Create_Excist(object obj1)
{
object one = ((object[])obj1)[0];
object two = ((object[])obj1)[1];
Cheers!