I am trying to parse data from several websites continuously. I would like this action to be preformed individually in a loop in an asynchronous manner until the program is clos
If you want to visit the site again as soon as it is complete, you probably want to use Task.WhenAny and integrate your outer loop with your inner loop, something like this (assuming the ParseData function will return the Site it is parsing for):
async public void ParseAll(List SiteList)
{
while (true)
{
List> TaskList = new List>();
foreach(Site s in SiteList)
{
TaskList.Add(s.ParseData());
}
await Task.WhenAny(TaskList);
TaskList = TaskList.Select(t => t.IsCompleted ? t.Result.ParseData() : t).ToList();
}
}