Hi,
I'm traying to make a thread array to a function with one variable, but i get everytime an error. I trayed to put the variable by the call, but the compiler doen't like that too.
I'm traying to make a thread array to a function with one variable, but i get everytime an error. I trayed to put the variable by the call, but the compiler doen't like that too.
Code:
static void Main(string[] args)
{
Thread[] threads = new Thread[5];
for(int i = 0; i < threads.Length; i++)
{
threads[i] = new Thread(new ThreadStart(DoWork));
}
for(int i = 0; i < threads.Length; i++)
{
threads[i].Start();
}
for(int i = 0; i < threads.Length; i++)
{
threads[i].Join();
}
Console.WriteLine("Complete");
}
public void DoWork(String myStr)
{
Console.WriteLine("DoWork"+myStr);
}
Comment