I have the following piece of code (changed the names of my classes/objects for brevity). It essentially is hitting an external API that allows only a single operation, but my service code will expose it as a bulk
type request.
It doesn't seem right to await on each async request, but instead dispatch all the requests and just wait for all of them. I could be wrong tho.
public async void SendSeveralRequestsAsync(MyClass myClass)
{
var client = SomeExternalServiceClient();
foreach(var item in myClass)
{
var singleAsyncRequest = new ExternalServiceRequest()
{
Value = item.Value
};
var response = await client.SendAsync(singleAsyncRequest);
}
}