Skip to content

Instantly share code, notes, and snippets.

@EifelMono
Last active December 9, 2017 17:03
Show Gist options
  • Save EifelMono/58d9e7f3eca88e5b407dedf99f0feb75 to your computer and use it in GitHub Desktop.
Save EifelMono/58d9e7f3eca88e5b407dedf99f0feb75 to your computer and use it in GitHub Desktop.
Task.WhenAny(Task1, Task2, ....., CancellationTokenSource1.AsTask())
public static class TasksExtensions
{
public static Task AsTask(this CancellationTokenSource cancellationTokenSource, int delay= -1)
{
return Task.Delay(delay, cancellationTokenSource.Token);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment