标签:star ring oid tar 处理 pre log namespace app1
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { List<Task> taskList = new List<Task>(); taskList.Add( Task.Factory.StartNew(()=> { Thread.Sleep(1000); Console.WriteLine("1秒执行结束"); })); taskList.Add(Task.Factory.StartNew(() => { Thread.Sleep(800); Console.WriteLine("o.8秒执行结束"); })); Console.WriteLine("执行中"); TaskFactory taskFactory = new TaskFactory(); taskList.Add(taskFactory.ContinueWhenAll(taskList.ToArray(), tArray => { Thread.Sleep(200); Console.WriteLine("等待这些完成后执行"); })); //Console.WriteLine("执行完成"); Console.Read(); } } }
标签:star ring oid tar 处理 pre log namespace app1
原文地址:http://www.cnblogs.com/ProDoctor/p/7101658.html