public class Program { static void Main(string[] args) { /* * 具体业务中比如首页数据加载,可能需要调用多个模块 * 1、采用并行执行 * 2、耗时的操作采用异步的方法 */ for (int i = 0; i < 1; i++) { Parallel.Invoke( () => { Task.Factory.StartNew(() => { Task.Delay(10000).Wait(); WaitTest();//耗时操作 }); }, () => { for (int j = 0; j < 10; j++) { Console.WriteLine($"第二:{j}"); } } ); Console.WriteLine("结束"); } Console.WriteLine("是结束了"); Console.ReadKey(); } private static void WaitTest() { Thread.Sleep(10000); Console.WriteLine("异步"); } }