1、Task类构造函数

时间:2021-09-09 11:57:04

Task类的构造函数接收一个无参无返回值的委托:

   1: Task task = new Task(TaskMethod);

   2: task.Start();
例子:  task = new Task(() =>
                        {
                            方法1,方法2....;
                        });
if (task != null)
    {
     task.Start();
    }