public static class TaskExtensions
{
public static async Task<Task> ProcessCompleted(this IList<Task> tasks)
{
if (tasks == null)
{
throw new ArgumentNullException(nameof(tasks));
}
Task completedTask = await Task.WhenAny(tasks);
tasks.Remove(completedTask);
return completedTask;
}
}
Created
June 25, 2018 06:36
-
-
Save webJose/4f777feffcb1bd4b55dc26bc9e9aa3fc to your computer and use it in GitHub Desktop.
Process pending async tasks in the order they are completed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment