代碼:
ThreadPool.SetMaxThreads(100, 100); ThreadPool.QueueUserWorkItem((obj) => { MessageBox.Show("執行線程中的代碼"); }); Thread.Sleep(1000); int n = 8; ThreadPool.QueueUserWorkItem((obj) => { MessageBox.Show("傳入的參數是:" + Convert.ToInt32(obj)); }, n); View Code