Tutorial by Examples: cancellationtoken

var cancellationTokenSource = new CancellationTokenSource(); var cancellationToken = cancellationTokenSource.Token; var task = new Task((state) => { int i = 1; var myCancellationToken = (CancellationToken)state; while(true) { Console.Write...
emails.Subscribe(email => Console.WriteLine("Email from {0} to {1}", email.From, email.To), cancellationToken);
public class Foo { private CancellationTokenSource _cts; public Foo() { this._cts = new CancellationTokenSource(); } public void StartExecution() { Task.Factory.StartNew(this.OwnCodeCancelableTask, this._cts.Token); } public void Cance...

Page 1 of 1