C# Task ContinueWith

 static void Main(string[] args)
        {
            Task firstTask = Task.Run(() =>
            {
                PrintPlus();
            });
           
            Task secondTask = firstTask.ContinueWith(x=>
            {
                Console.WriteLine("\n");
                PrintMultiply();
            });
            
            Console.ReadLine();
        }

        static void PrintPlus()
        {
            for(int i=0;i<1000;i++)
            {
                Console.Write("+\t");
            }
        }

        static void PrintMultiply()
        {
            for(int i=0;i<1000;i++)
            {
                Console.Write("*\t");
            }
        }

 

posted @ 2019-11-09 21:09  FredGrit  阅读(1098)  评论(0编辑  收藏  举报