I have a code to call a function in a loop, which would access endpoints asynchronously, coded like this:
public async Task HitEndPointsAsync()
{
for (int i = 0; i < _urls.Length; i++)
{
await HitOneEndPointAsync(i);
}
}
The simplified function HitOneEndPointAsync looks like this:
private async Task HitOneEndPointAsync(int i)
{
var newRec = InsertRec(i);
ExtURL extUrl = new ExtURL(_urls[i]);
result = await extUrl.GetAsync(_parms[i]);
UpdateRec(i, result);
}
If I remove the await in HitEndPointsAsync, then the await that is in HitOneEndPointAsync is no longer effective. If I need all endpoints to be called at once, but on each call await for the response to process that response further, would this be an option? Because as soon as I remove the await at the function call level, the await down the line is ignored. Thoughts?