天天看点

[转贴]ParameterizedThreadStart,ThreadStart的使用,线程Thread传参数

Thread

threadWithParam = new Thread(new ParameterizedThreadStart(new ThreadTest().ShowMsg));//threadWithParam.Start("this is a param.");

threadWithParam.Start(

thread.Start();

"44444");Thread thread=new Thread(new ThreadStart(new Class11().ShowMsg));

using System.Threading;

public void ShowMsg()

{

    MessageBox.Show("Message Info.");

}

Thread thread = new Thread(new ThreadStart(ShowMsg));

//带参数

public void ShowMsg(object msg)

    MessageBox.Show(msg.ToString());

Thread threadWithParam = new Thread(new ParameterizedThreadStart(new ThreadTest().ShowMsg));

threadWithParam.Start("this is a param.");

继续阅读