Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created June 3, 2018 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NMZivkovic/138ee27d8c5fd3ea5778e90a8e931b25 to your computer and use it in GitHub Desktop.
Save NMZivkovic/138ee27d8c5fd3ea5778e90a8e931b25 to your computer and use it in GitHub Desktop.
var token = new CancellationTokenSource();
string result = await OperationAsync(param1, param2, param3, token.Token);
… // at some point later, potentially on another thread
token.Cancel();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment