线程池
public class QueueUseWorkItem{ public static void Run(){ Stopwatch watch = Stopwatch.StartNew(); watch.Start(); WaitCallback callback = index =>{ System.Console.WriteLine($"在{watch.Elapsed}毫秒,线程{index}启动成功"); }; for(int i=0; i<20; i++) { ThreadPool.QueueUserWorkItem(callback,i); } } }