启动一个线程是调用 start() 方法,new一个ThreadStart class, 然后,把ThradStart class对象传给Thread类,Thread类start()
View Code
public class ThreadWork { public static void DoWork() { for (int i = 0; i < 5; i++) { Console.WriteLine("Working thread..{0}", i); Thread.Sleep(100); } } } class Program { static void Main(string[] args) { ThreadStart myStart = new ThreadStart(ThreadWork.DoWork); Thread myThread = new Thread(myStart); //启用一个Thread myThread.Start(); } }