class Program
    {
       static public void test()
        {
            Console.WriteLine("任务开始");
            Thread.Sleep(3000);
            Console.WriteLine("任务结束");
        }
        static void Main(string[] args)
        {
            Task tk = new Task(test);
            tk.Start();
            TaskFactory tf = new TaskFactory();
            tf.StartNew(test);
            Console.ReadKey();
        }
    }

  

posted on 2022-06-09 13:51  sbwynnss  阅读(21)  评论(0编辑  收藏  举报