110,536
社区成员
发帖
与我相关
我的任务
分享
Thread thread = new Thread(new ParameterizedThreadStart(this.PRun));
thread.Start(new string[] { "刘德华", "9001" });
public void PRun(object paras) {
string[] realParas = (string[])paras;
Run(realParas[0], realParas[1]);
}
public void Run(string name, string id){
...
}
static void Main(string[] args)
{
string name = "sfsfsf";
string id = "12323";
Thread th = new Thread(new ThreadStart(delegate()
{
run(name, id);
}));
th.Start();
Console.Read();
th.Abort();
}
public static void run(string name, string id)
{
Console.WriteLine(name + "," + id);
}
Thread thd = new Thread(new ParameterizedThreadStart(connect));
thd.Start(123);
///线程方法
void connect(object nId)
{
nId.ToString();
}