I wanna try something like download from a collection of image in a minimum of 3 concurrent download but, as soon as one of the 3 finished downloading add a new download from the list or must wait to add a new download until a download is finished from 3 concurrent download. How do I implement something like that?
So far I have tried this, but it seems to download all without waiting to be finished from at least 1 from the 3 concurrent download.
List<string> listOfLink = new List<string>();
await Task.Run(() =>
Parallel.ForEach(listOfLink, new ParallelOptions { MaxDegreeOfParallelism = 3 }, async (link, state, index) =>
{
//Download image httpclient
//DownloadImageAsync(link);
}));