I thought I understand the async-await
pattern in C#
but today I\'ve found out I really do not.
In a simple code snippet like this. I have
It awaits the completion of the HTTP request. The code resumes (for
iteration...) only after every single request is complete.
Your 2nd version works precisely because it doesn't await for each task to complete before initiating the following tasks, and only waits for all the tasks to complete after all have been started.
What async-await is useful for is allowing the calling function to continue doing other things while the asynchronous function is awaiting, as opposed to synchronous ("normal") functions that block the calling function until completion.