We're walking the path set forth by Lee Campbell's Intro to Rx.
- Key types
IObservable<T>
andIObserver<T>
(and maybe evenISubject<T>
)Subject<T>
,ReplaySubject<T>
,BehaviorSubject<T>
,AsyncSubject<T>
- Lifetime management
IDisposable
and its variants- The
IDisposable
returned by theSubscribe
extension methods will dispose itself uponOnCompleted
orOnError
. Other implementations won't. Still, you should always capture and dispose of subscriptions yourself when possible.
- Creating sequences
- Introducing
Timestamp
andTimeInterval
as handy tools for reasoning about streams - Creating sequences and the power of the lazily evaluated
Observable.Create
- Functional unfolds and the other powerful generation method:
Observable.Generate
- Transitioning into observables by switching between domains (from
Task
orAction
/Func
)
- Introducing
- Reducing sequences
- Filtering with
Where
- Determining
Distinct
elements, and introducing pairwise distinction withDistinctUntilChanged
Skip
andTake
- Filtering with
- Inspecting sequences
Any
vs.All
vs.Contains
- Gracefully handling the empty sequence scenario
ElementAt
and why not to use it- Comparing two sequences for equality with
SequenceEqual
- Aggregating sequences
- Sequence math:
Min
,Max
,Sum
,Average
- Functional folds:
First/Last/Single[OrDefault][Async]
- Custom aggregations and the relationship between
Aggregate
andScan
- Partitioning sequences
- Sequence math:
- Transforming sequences
- Mapping with
Select
and its contactual obligations - Casting and materializing
SelectMany
, the powerfulbind function
- Visualizing sequences
- Mapping with
- Side effects
- Never leak effects out of pipelines, but if you must, use
Do
to emphasize them
- Never leak effects out of pipelines, but if you must, use
- Advanced error handling
Catch
vs.OnErrorResumeNext
, maybeRetry
Using
binds the lifetime of a resource to that of a sequenceFinally
no matter what
- Combining sequences
- Combining sequentially requires completion:
Concat
,Repeat
,StartWith
- Combining concurrently doesn't:
Amb
,Merge
,Switch
- Pairing is either in sync with the rate of generation:
Zip
&And/Then/When
, or it isn't:CombineLatest
- Combining sequentially requires completion:
- Time-shifted sequences
Buffer
ing: size vs. time triggers- Overlapping, rolling or skipped buffering
- Simple time shifting with
Delay
Sample
vs.Throttle
Timeout
and the beauty of operator composure
- Temperature
- Use
Publish
andConnect
for taming hotness - Use
Publish
andRefCount
for the added benefit of the last guy turns off the light - Discover
Multicast
and its power
- Use
- Scheduling
- Rx is single threaded and synchronous by default
SubscribeOn
is for scheduling the subscription code (like forObservable.Create
)ObserveOn
is for moving the processing to another threadImmediateScheduler
vs.CurrentThreadScheduler
,EventLoopScheduler
vs.NewThreadScheduler
ThreadPoolScheduler
vs.TaskPoolScheduler
,DispatcherScheduler