Skip to content

Instantly share code, notes, and snippets.

@johnmmoss
Created August 10, 2020 20:26
Show Gist options
  • Save johnmmoss/aff1d9e84846ce9046dfecc41c9c3139 to your computer and use it in GitHub Desktop.
Save johnmmoss/aff1d9e84846ce9046dfecc41c9c3139 to your computer and use it in GitHub Desktop.
var tasks = new List<Task<ResponseDto>>();
foreach (var survey in filteredSurveys)
{
var task = Task.Run(() => GetResponses(survey));
tasks.Add(task);
}
Task.WaitAll(tasks.ToArray());
return tasks.Select(x => x.Result).ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment