Created
January 8, 2018 15:59
-
-
Save SpeedOfSpin/510897268803ca9ced2c7f8aaadef109 to your computer and use it in GitHub Desktop.
setTimeout equivalent in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cancellationTokenSource = new CancellationTokenSource(); | |
var cancellationToken = cancellationTokenSource.Token; | |
Task.Delay(2000).ContinueWith(async (t) => | |
{ | |
//Do stuff | |
}, cancellationToken); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
works well without tokens