Are regular iterator blocks (i.e. \"yield return\") incompatible with \"async\" and \"await\"?
This gives a good idea of what I\'m trying to do:
asyn
What you are describing can be accomplished with the Task.WhenAll method. Notice how the code turns into a simple one-liner. What happens is that each individual url begins downloading and then WhenAll is used combine those operations into a single Task which can be awaited.
Task> DownLoadAllUrls(string[] urls)
{
return Task.WhenAll(from url in urls select DownloadHtmlAsync(url));
}