Subscribing/unsubscribing to an observable (IDisposable)

Download system.reactive eBook

Example

Subscription returns an IDisposable:

IDisposable subscription = emails.Subscribe(email =>
    Console.WriteLine("Email from {0} to {1}", email.From, email.To));

When you are ready to unsubscribe, simply dispose the subscription:

subscription.Dispose();

Stats

Contributors: 3
2016-07-22
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook