This is a list of quick guidelines intended to help you when writing Rx queries.
IEnumerable<T>
and IObservable<T>
sequences. Return an empty sequence instead.OnError
handler.First
, FirstOrDefault
, Last
, LastOrDefault
, Single
, SingleOrDefault
and ForEach
.; use the non-blocking alternative such as FirstAsync
.IObservable<T>
and IEnumerable<T>
into
keywordquery
, q
, xs
, ys
, subject
etc.Select
or Where
. Be explicit by using the Do
operator.Observable.Create
to subjects as a means of defining new Rx sources.IObservable<T>
interface. Use Observable.Create
(or subjects if you really need to).IObserver<T>
interface. Favour using the Subscribe
extension method overloads instead.SubscribeOn
and ObserveOn
operators should always be right before a Subscribe
method. (So don't sandwich it, e.g. source.SubscribeOn(s).Where(x => x.Foo)
.)