代码:
ThreadPool.SetMaxThreads(100, 100); ThreadPool.QueueUserWorkItem((obj) => { MessageBox.Show("执行线程中的代码"); }); Thread.Sleep(1000); int n = 8; ThreadPool.QueueUserWorkItem((obj) => { MessageBox.Show("传入的参数是:" + Convert.ToInt32(obj)); }, n);
代码:
ThreadPool.SetMaxThreads(100, 100); ThreadPool.QueueUserWorkItem((obj) => { MessageBox.Show("执行线程中的代码"); }); Thread.Sleep(1000); int n = 8; ThreadPool.QueueUserWorkItem((obj) => { MessageBox.Show("传入的参数是:" + Convert.ToInt32(obj)); }, n);