Class Sample
Represents an operator that samples elements from an observable sequence whenever the second sequence emits a notification.
Sample
always emits the most recent element received from the source sequence. If multiple elements are received between sampling events, all but the latest element will be dropped from the result sequence. Conversely, elements are never repeated: if no new elements are received between two sampling events, no notifications will be emitted.
Note
If the sampler sequence completes successfully, the termination event will be used to sample the latest element from the source sequence, if it exists.
[Combinator]
public class Sample
- Inheritance
-
Sample
- Inherited Members
Methods
Process<TSource, TOther>(IObservable<TSource>, IObservable<TOther>)
Samples elements from the first sequence whenever 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 sample.
other
IObservable<TOther>The sequence of sampling notifications.
Returns
- IObservable<TSource>
The sampled observable sequence.
Type Parameters
TSource
The type of the elements in the
source
sequence.TOther
The type of the elements in the
other
sequence.
Remarks
Upon each sampling notification, the latest element (if any) emitted by
the source
sequence during the last sampling interval
is sent to the resulting sequence.