//使用ThreadStart委托来衍生三个新线程 using System; using SystemThreading; namespace ThreadStartSampleCS { class Program { static void Main() { Thread newThread; ThreadStart threadMethod = new ThreadStart(DoWork); for (int counter = ; counter < ; counter++) { ConsoleWriteLine(Starting Thread {} counter); newThread = new Thread(threadMethod); newThreadName = counterToString(); newThreadStart(); } ConsoleReadLine(); } static void DoWork() { for (int counter = ; counter < ; counter++) { ConsoleWriteLine(Thread {}: iteration {} ThreadCurrentThreadName counter); ThreadSleep(); } } } } |