1 Answers
By passing an instance of a WaitCallback delegate to theThreadPool.QueueUserWorkItem() method
class CApp
{
static void Main(){
string s = “Hello, World”;
ThreadPool.QueueUserWorkItem( new WaitCallback( DoWork ), s );
Thread.Sleep( 1000 ); // Give time for work item to be executed
}
// DoWork is executed on a thread from the thread pool.
static void DoWork( object state ){
Console.WriteLine( state );
}
}