Skip to content

Instantly share code, notes, and snippets.

@MelbourneDeveloper
Created January 31, 2021 00:51
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 MelbourneDeveloper/e62bf2e542458061bda4356b255bde12 to your computer and use it in GitHub Desktop.
Save MelbourneDeveloper/e62bf2e542458061bda4356b255bde12 to your computer and use it in GitHub Desktop.
Timeout
var cancellationTokenSource = new CancellationTokenSource();
//Fire a timeout after 1000 milliseconds
cancellationTokenSource.CancelAfter(1000);
var result = await device.WriteAndReadAsync(writeData, cancellationTokenSource.Token);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment