标签:blog ar div on art log line new as
class Program { static void Main(string[] args) { Run(); } public static async void Run() { var tasks = StartMultiWorkerTasks(); if (tasks.Length > 0) { await Task.WhenAll(tasks).ContinueWith(t => { Console.WriteLine("done ......"); }); } Task.WaitAll(tasks); } /// <summary> /// Start multi tasks /// </summary> /// <param name="request"></param> /// <param name="coupleSyncResult"></param> /// <returns></returns> public static Task[] StartMultiWorkerTasks() { Task[] tasks = new Task[3]; tasks[0] = Task.Run(() => Console.WriteLine("do some thing 1....................")); tasks[1] = Task.Run(() => Console.WriteLine("do some thing 2....................")); tasks[2] = Task.Run(() => Console.WriteLine("do some thing 3....................")); return tasks; } }
标签:blog ar div on art log line new as
原文地址:http://www.cnblogs.com/mawenzhu/p/4056547.html