KEMBAR78
Reactive extensions for dot net | PPTX
Reactive
          Extensions for
              .NET
                Previously Linq to Events



Eric R Taylor                               7/10/2012   1
IObserver - Observable
• Comparable to IEnumerable and IEnumerator
• Built into .Net 4.0, In the System namespace




 Eric R Taylor                               7/10/2012   2
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
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
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
Merge




Eric R Taylor           7/10/2012   6
SkipUntil - TakeUntil



                green.SkipUntil(blue).TakeUntil(red)




Eric R Taylor                                          7/10/2012   7
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
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
Scheduler
• Most extensions that are time based have overrides
  that accept a scheduler.




 Eric R Taylor                                7/10/2012   10
Standard Event
                 Composition




Eric R Taylor                    7/10/2012   11
Converting Standard
   Events into Observables




Eric R Taylor           7/10/2012   12
Rx Event Composition




Eric R Taylor            7/10/2012   13
Rx Event Projection




Eric R Taylor                         7/10/2012   14
Rx IObservable Chaining




Eric R Taylor       7/10/2012   15
Rx Multiple Subscribers




Eric R Taylor           7/10/2012   16
Rx Multiple Subscribers




Eric R Taylor           7/10/2012   17

Reactive extensions for dot net

Editor's Notes

  • #2 Events as data over time