var moviePromises = this.watchlist.Select(async e => await this.GetMovieFromWatchlistEntry(e));
var movies = await Task.WhenAll(moviePromises);
foreach (var movie in movies)
{
// dostuff
}
When I am doing the following it seems that all tasks created in (GetMovieFromWatchlistEntry
) and are executed at the same time. but I want that at each step of the iteration a single task is created and awaited (lazy evaluation). I guess this is possible with IAsyncEnumerable
, but how can I create a IAsyncEnumerable
from my existing moviePromises
enumerable?