I'm writing a class for managing my threading. How do I pass my method that needs threading into my helper class?
All that I'll be doing is creating a new thread and passing the method I've passed through into a new ThreadStart().
Thanks in advance.
I'm writing a class for managing my threading. How do I pass my method that needs threading into my helper class?
All that I'll be doing is creating a new thread and passing the method I've passed through into a new ThreadStart().
Thanks in advance.
Rather than write your own class to manage threading I suggest you check out the BackgroundWorker class in .NET 2.0 onwards.
I'm not sure what you mean by passing void but this should help:
void StartThread(ThreadStart method) {
new Thread(method).Start();
}
and call it with:
StartThread(myMethod);