将 .NET 任务与方法和操作一起使用有什么区别?

What the difference between using .NET tasks with method and action?

方法:

static void HelloWorld() { Console.WriteLine(“Hello, world!”); }

有什么区别

Task t1 = new Task(HelloWorld);

Task t2 = new Task(new Action(HelloWorld));

实际上没有区别。事实上,在这两种情况下编译器生成相同的代码:

Task task2 = new Task(new Action((object) null, __methodptr(HelloWorld)));