编程语言
首页 > 编程语言> > Taskfactoy开启线程C#

Taskfactoy开启线程C#

作者:互联网

 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();
        }
    }

  

标签:Task,Console,C#,Taskfactoy,线程,tk,WriteLine,test,static
来源: https://www.cnblogs.com/bhnian/p/16359046.html