出自http://hi.baidu.com/ydalbj/blog/item/330b8d13f6959dd5f6039ec4.html
Thread
threadWithParam = new Thread(new ParameterizedThreadStart(new ThreadTest().ShowMsg));//threadWithParam.Start("this is a param."); threadWithParam.Start( thread.Start(); 表示在 Thread 上执行的方法的委托方法,ThreadStart不能带参数,ParameterizedThreadStart是2.0中新增的,可以带参数(object类型的) using System.Threading; public void ShowMsg() Thread thread = new Thread(new ThreadStart(ShowMsg)); //带参数 public void ShowMsg(object msg) Thread threadWithParam = new Thread(new ParameterizedThreadStart(new ThreadTest().ShowMsg));
{
MessageBox.Show("Message Info.");
}
thread.Start();
{
MessageBox.Show(msg.ToString());
}
threadWithParam.Start("this is a param.");