使用.NET TPL Dataflow的
ActionBlock
时,直接指定Action
和使用Func<Task>
有什么区别呢?
直接指定Action:
new ActionBlock<Message[]>(x => DoSomething(x))
任务:
new ActionBlock<Message[]>(x => Task.Run(() => DoSomething(x)))
我想了解并发执行(MaxDegreeOfParallelism
> 1)方面的区别。