Class SkipUntil
Represents an operator that returns the elements from the first sequence only after the second sequence emits a notification.
SkipUntil
modifies the source sequence so that all elements are ignored until the second sequence produces a notification. At that time, SkipUntil
will start emitting all remaining elements from the source sequence. SkipUntil
is often used to create a dynamic start condition for an infinite sequence, e.g. start grabbing frames from a video camera when a key is pressed.
If the source sequence terminates before the second sequence produces a value, SkipUntil
will terminate without emitting any elements.
Warning
SubscribeWhen
is a similar operator which is often used to control the start of a sequence. Although often both SubscribeWhen
and SkipUntil
result in a similar sequence, SkipUntil
will always immediately subscribe to the source sequence. This means that any initialization side-effects will be evaluated immediately. For hot sequences (e.g. camera) this might be advantageous, since any initialization costs are paid upfront, and new values are immediately ready to be consumed after the trigger. However, for cold sequences (e.g. video) this might lead to loss of data from the start of the sequence. For more about the difference between hot and cold sequences, see the section on temperature.
[Combinator]
public class SkipUntil
- Inheritance
-
SkipUntil
- Inherited Members
Methods
Process<TSource, TOther>(IObservable<TSource>, IObservable<TOther>)
Returns the elements from an observable sequence only after the second sequence emits a notification.
public IObservable<TSource> Process<TSource, TOther>(IObservable<TSource> source, IObservable<TOther> other)
Parameters
source
IObservable<TSource>The source sequence to propagate elements for.
other
IObservable<TOther>The observable sequence indicating the time at which to start taking elements from the
source
sequence.
Returns
- IObservable<TSource>
An observable sequence containing the elements of the
source
sequence emitted after theother
sequence emits a notification.
Type Parameters
TSource
The type of the elements in the
source
sequence.TOther
The type of the elements in the
other
sequence.