I am using multithreading in my C# code as follow:
Thread startThread; public void NewThread() { ThreadStart starter = delegate { foo(); }; startThread = new Thread(starter); startThread.Start(); } private void foo() { //do some work } And then in my application I call NewThread()to run the new thread.
But now I am having lots of threads on each class and each one has a NewThread() for itself, I was thinking of moving this to a static Util class and pass it the function name each time I want a new thread on that function.
Do you know how this the best way of doing it, if yes how can I pass the function name as a parameter to it?