共用方式為


Asynchronous enumerations - Part 1: Task>

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

  • Anonymous
    July 05, 2013
    Shortest blog post I have ever read!

  • Anonymous
    July 07, 2013
    Poderia ser melhor...