I am looking to make a skeleton that will process concurrent downloads. I am not sure if I get that for free using Task.Run or not? My code below has a foreach loop, but what I really want is not to go one at a time but take 5 concurrently on their own thread and then continue processing whenever one gets done move it through more processing. Am I doing this now?
public async Task ProcessBatch()
{
CreateConnection();
List<string> items=new List<string>();
foreach (var item in items)
{
//do do stuff that possibly takes awhile
var result = await Task.Run(() => DownloadItems());
//do more processing on whatever item is done now
}
}