I have a bunch of remote http calls to make and I need to fire them off in parallel but wait for them all to complete before I can continue processing. This is an ASP.NET Core MVC website, so I am happy that when I am waiting the server is doing something else.
These http calls are using PostAsJsonAsync on an http client, so they are async anyway.
Is the correct approach a List<Task> and each task having the http request in and then doing a listoftasts.WaitAll() or am I missing something painfully obvious. There is listoftasks.WhenAll() as well. But I need execution of the thread to not continue because what happens is dependent on the results of the operations.
I find that docs change and this is 2022 question and dot net sometimes does things differently. Plus the fact that the PostAsJsonAsync is an async operation anyway may change things.
Thanks
Paul