Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Reactive extensions for dot net
1. Reactive
Extensions for
.NET
Previously Linq to Events
Eric R Taylor 7/10/2012 1
2. IObserver - Observable
• Comparable to IEnumerable and IEnumerator
• Built into .Net 4.0, In the System namespace
Eric R Taylor 7/10/2012 2
3. Push vs. Pull
• Pull – IEnumerable
o Gather a set of data
o Do something for each item in the set
• Push – IObservable
o Decide what you want to do for each item
o React to each item as it is introduced
Eric R Taylor 7/10/2012 3
4. Linq Extensions
• Extension methods based on IEnumerable<T>
• Chainable
• Filtering – Where
• Projection – Select
• Paging – Take, Skip
• Composition – Join
• Rearrange – OrderBy
Eric R Taylor 7/10/2012 4
5. Reactive Extensions
• Extension methods based on IObservable<T>
• Chainable
• Filtering – Where
• Projection – Select
• Paging – TakeUntil, SkipUntil
• Composition – Merge, Zip, CombineLatest
• Time based – Interval, Delay, Throttle, Sample
Eric R Taylor 7/10/2012 5
8. Buffer
1 2 3 4 5 6 7
1 2 3 4 5 6
2 3 4 5 6 7
Eric R Taylor 7/10/2012 8
9. Subscriptions
• Joining an IObserver to an IObservable
• Returns an IDisposable, Dispose to unsubscribe
• Extension methods for Subscribe overrides
Eric R Taylor 7/10/2012 9
10. Scheduler
• Most extensions that are time based have overrides
that accept a scheduler.
Eric R Taylor 7/10/2012 10