using System;
using System.Threading;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Thread thread = new Thread(DoWork);
thread.Start("thread start.");//这边传入参数
Console.ReadKey();
}
static void DoWork(object arg)
{
Console.WriteLine(arg.ToString());
}
}
}Thread构造函数(ParameterizedThreadStart)使用示例
在多线程编程中,有时需向线程调用的方法传入参数,使用Thread构造函数(ParameterizedThreadStart)可以实现:
评论(0)
暂无评论。