Controlling Execution Flow While Producing IAsyncEnumerable Sequences

Producing IAsyncEnumerable The introduction of IAsyncEnumerable to C# allowed for simplifying a lot of scenarios that used to require a lot of code to get async behavior similar to an equivalent synchronous scenario. The await foreach construction specifically makes the consumption side almost trivial. The combination of the delayed execution of IEnumerable and asynchrony does add some complexity though, which can often come into play on the side of producing the async collection and trying to build control flow or error handling into the process....

April 26, 2023 · 13 min · 2597 words · John Bowen