2
Answers

MultiThreading in C#

Space Ghost

Space Ghost

12y
3k
1
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}


Answers (2)