How is an observable subscription gracefully terminated?
问题 I'm attempting to use Reactive Extensions (Rx) to process a stream of data. The processing of each element may take some time, though. To break the processing, I'm using a CancellationToken , which effectively stops the subscription. When cancel has been requested, how do I gracefully finish the current work and terminate properly without losing any data? Example var cts = new CancellationTokenSource(); cts.Token.Register(() => Console.WriteLine("Token cancelled.")); var observable =