1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49:
class Program { static void Main(string[] args) { Task task1 = new Task(() => { for (int i = 0; i < 10; i++) { Thread.Sleep(1000); Console.WriteLine("1"); } }); task1.Start(); //task1.Wait(); Task task2 = new Task(() => { Thread.Sleep(3000); for (int j = 0; j < 10; j++) { Thread.Sleep(1000); Console.WriteLine("2"); } }); if (task1.IsCompleted) { task2.Start(); } Task task3 = Task.Factory.StartNew(() => Task3void("abc")); //task3.Start(); Console.ReadKey(); } public static void Task3void(string strInput) { Thread.Sleep(3000); Console.WriteLine("Input string is : " + strInput); } }