Asynchronous enumerations – Part 1: Task<IEnumerable<T>>

For background, read the introduction.

If you need all data before you start processing it or if you expect just a few records each time, then this is probably your simplest way to get an “asynchronous enumeration”. Technically the enumeration is not asynchronous since you retrieve all data asynchronously first and then process it. You can also easily use LINQ on the enumeration for processing which is very nice.

The only real drawback is that you’re not flexible in case you one day will retrieve a lot of data (or no longer need al data at once for processing). If you have those needs from day one, then this is not the option for you I think.

Comments (2)

  1. Ahmet Alp Balkan says:

    Shortest blog post I have ever read!

Skip to main content