Class Take
Represents an operator that returns the specified number of contiguous elements from the start of an observable sequence.
The Take
operator modifies the source sequence to emit only the specified maximum number of values from the start of the sequence. If the maximum number of values is reached, Take
will terminate immediately and ignore the remainder of the sequence. Take
is commonly used to convert an infinite sequence into a finite sequence, for example to take the first key press out of an infinite sequence of keyboard key presses.
Take
only specifies a maximum upper bound on the number of elements. If the source sequence terminates before that maximum number of values is reached, the behavior of the sequence will not be modified.
public class Take : Combinator
- Inheritance
-
Take
- Inherited Members
Properties
Count
Gets or sets the number of elements to take.
public int Count { get; set; }
Property Value
Methods
Process<TSource>(IObservable<TSource>)
Returns the specified number of contiguous elements from the start of an observable sequence.
public override IObservable<TSource> Process<TSource>(IObservable<TSource> source)
Parameters
source
IObservable<TSource>The sequence to take elements from.
Returns
- IObservable<TSource>
An observable sequence that contains the specified number of elements from the start of the
source
sequence.
Type Parameters
TSource
The type of the elements in the
source
sequence.