Sep 4, 2018 · 1 min read
None of these examples are actually asynchronous; they’re all running synchronous code on a background thread. The C# Task/async/await patterns were designed for true asynchronous code, where no background thread is necessary. Java still lacks a good API for this use case.
In particular, StartNew, ContinueWith, and Unwrap are all low-level building blocks, so of course they’ll be awkward. C# fills all the gaps you’ve mentioned with the async and await keywords; no additional APIs are necessary (or desired, IMO). Async/await were designed for natural composability.
(BTW, you should use Task.Run instead of Task.Factory.StartNew).
