This is the way of running thread in ThreadPool
1 only for 4.5 Framework
1 only for 4.5 Framework
Task.Run(() => doStuff("hello world"));
2
Task.Factory.StartNew(() => doStuff("hello world"));
3
ThreadPool.QueueUserWorkItem(a => doStuff("hello world"));
4
void Example()
{
// Hook up the ProcessFile method to the ThreadPool.
// Note: 'a' is an argument name. Read more on arguments.
ThreadPool.QueueUserWorkItem(new WaitCallback(ProcessFile), a);
}
private void ProcessFile(object a)
{
// I was hooked up to the ThreadPool by WaitCallback.
}