static void Main() { int threadId; AsyncDemo ad = new AsyncDemo(); AsyncMethodCaller caller = new AsyncMethodCaller(ad.TestMethod); IAsyncResult result = caller.BeginInvoke(3000, out threadId, null, null); Thread.Sleep(0); Console.WriteLine("Main thread {0} does some work.", Thread.CurrentThread.ManagedThreadId); result.AsyncWaitHandle.WaitOne(); string returnValue = caller.EndInvoke(out threadId, result); result.AsyncWaitHandle.Close(); Console.WriteLine("The call executed on thread {0}, with return value \"{1}\".", threadId, returnValue); Console.ReadKey(true); }