How to pass parameters to Thread.ThreadStart() method in C#?

Suppose I have method called ‘download’

public void download(string filename)
{
    // download code
}

Now I have created one thread in the main method:

Thread thread = new Thread(new ThreadStart(download(filename));

error method type expected.

How can I pass parameters to ThreadStart with target method with parameters?

10 Answers
10

Leave a Reply

Your email address will not be published. Required fields are marked *