-
Notifications
You must be signed in to change notification settings - Fork 1
Day 09 Rx.Net part 3
Kobi Hari edited this page Nov 10, 2020
·
2 revisions
Advanced Rx.Net | Advanced Rx operators and examples |
- We used the The
Do
Operator to create log and allow debugging- We noticed that
Do
does not actually do anything until the observable is subscribed to - We understood the difference between
Do
andSubscribe
- We noticed that
- We used subjects as HUB and created a demo where the subject turns a cold observable to hot
- We distinctify between the two roles that the subject serves when used as a hub
- It publishes the same events to all observers
- It "activates" the source by subscribing to it
- We got familiar with the
Publish
operator which serves like aSubject
-
Publish
turns a cold observable to hot - The actual subscription is deffered until the
Connect
method is called - You can use
Publish(initialValue)
to create aBehaviorPublisher
that behaves like aBehaviorSubject
- You can disconnect using the
IDisposable
returned from theConnect
method - You can use
PublishLast
to create a publisher that acts likeAsyncSubject
-
- We used the
.Publish().Refcount()
to create a publisher that automatically connects to source when the first observer subscribes to it - We used the
Multicast
operator that is similar toPublish
except that we can provide our own subject to be used as hub. - We turned a Hot Observable into Cold by using the
Replay
Operator
- We saw how to use Sum, Count, Max, ToList - All reactive!!!
- We saw that they return a Scalar Observable - an observable that returns a single value
- We learned how to use
Aggregate
to create a general aggregator - We saw the
Scan
Operator and realized it is just likeAggregate
except it returns sub results after each source event.
- We used the
Select
Operator to create an Observable of Observables - We saw that we can also use
GroupBy
andWindow
to transfer a flat observable into second order one. - We saw that
Buffer
is similiar toWindow
except that it returnsIObservable<IEnumerable<T>>
- We used
Merge
to collect all events from all observables into a single observable - We used
Switch
to collect events from the latest observable while switching between them - We used
Concat
to collect events sequentially from one observable after another.
- We saw the The
Zip
Operator that combines 2 (or more) observables by matching events with the same index and combining them togher using a projection method - We saw the
CombineLatest
Operator and realized it is likeZip
except that it yields a combined event whenever either operand yields an event. - We saw the
WithLatestFrom
Operator which is likeCombineLatest
but not symmetrical, so it only yields events when the first observable yields them.