Doing a bunch of async things in any order? Like "concurrent" in Hack, but in C#? #4009
Replies: 4 comments 2 replies
-
async Task Foo() {
var task1 = Thing1();
var task2 = Thing2();
var task3 = Thing3();
return Task.WhenAll(task1, task2, task3);
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
await Task.WhenAll(thing1(), thing2(), thing3()); |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
bherila
-
With suitable extension methods on
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you to everyone for the super fast responses! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In Hacklang, I can do something like
Ref: https://docs.hhvm.com/hack/asynchronous-operations/concurrent
These are executed in any order and the block continues after all the
await
s are done. Of course there must be no dependencies between the items in the concurrent block. But in many cases this is just fine.Is there a clean way to do this in C#?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions