Class ElementAtOperator
Implements the ElementAt operator. Mirrors rxjs's elementAt.
public static class ElementAtOperator
- Inheritance
-
System.ObjectElementAtOperator
Methods
ElementAt<T>(Observable<T>, int)
Emits only the value at the given zero-based index of source, then
completes without waiting for source itself to complete.
public static Observable<T> ElementAt<T>(this Observable<T> source, int index)
Parameters
sourceObservable<T>The source observable to index into.
indexintThe zero-based index of the value to emit.
Returns
- Observable<T>
An observable of just the value at
index.
Type Parameters
TThe element type of the source observable.
Remarks
If source completes before reaching index, the result errors with an
ArgumentOutOfRangeException instead of completing.
ElementAt<T>(Observable<T>, int, T)
Emits only the value at the given zero-based index of source, or
defaultValue if source completes before reaching that index.
public static Observable<T> ElementAt<T>(this Observable<T> source, int index, T defaultValue)
Parameters
sourceObservable<T>The source observable to index into.
indexintThe zero-based index of the value to emit.
defaultValueTThe value to emit if
sourcecompletes before reachingindex.
Returns
- Observable<T>
An observable of the value at
index, ordefaultValueif out of range.
Type Parameters
TThe element type of the source observable and the default value.