将任务与https://github.com/louthy/language-ext绑定在一起需要返回类型为 ( ) 的任务Task<>。因此,没有返回类型的任务应转换为Task<Unit>.
有谁知道在 C# 中使用(或不使用)Language-ExtTask进行转换的紧凑(仅表达式)方法?Task<Unit>
换句话说:有类似fun(...)for 的东西Task吗?
Action直接指定或Func<Task>使用.NET TPL Dataflow有ActionBlock什么区别?
直接行动:
new ActionBlock<Message[]>(x => DoSomething(x))
Run Code Online (Sandbox Code Playgroud)
任务:
new ActionBlock<Message[]>(x => Task.Run(() => DoSomething(x)))
Run Code Online (Sandbox Code Playgroud)
我试图了解并行执行方面的差异(MaxDegreeOfParallelism> 1).