3 ms·
I find async/await in C# to be super useful, and fairly addictive once you start using it. Say you want to do three independent things in a function. How would
by ohitsdom 10y ago
I find async/await in C# to be super useful, and fairly addictive once you start using it. Say you want to do three independent things in a function. How would you run them in parallel without async? Delegates, background workers, or threads? With async, this is simply done with Task.WhenAll().
- zwieback 10y agoAgreed, there are situations where it's super useful and I never want to go back to the old way. I did read up on the paper that explains how the compiler rewrites the code before being comfortable using await.
- rapala 10y agoWell, the runtime then runs the Tasks in a thread pool, so using Task.WhenAll is just a one more item to the list of options in that sense. It is a nice abstraction though.
- aikah 10y agoWhat's wrong with threads and synchronizing? async I/O has its own level of complexity. But to be frank a better option is go-routines + channels + select construct like with go. That's really what makes both Go and Erlang unique.