Table of Contents

Class ElementAtOperator

Namespace
RxSharp.Operators
Assembly
RxSharp.dll

Implements the ElementAt operator. Mirrors rxjs's elementAt.

public static class ElementAtOperator
Inheritance
System.Object
ElementAtOperator

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

source Observable<T>

The source observable to index into.

index int

The zero-based index of the value to emit.

Returns

Observable<T>

An observable of just the value at index.

Type Parameters

T

The 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

source Observable<T>

The source observable to index into.

index int

The zero-based index of the value to emit.

defaultValue T

The value to emit if source completes before reaching index.

Returns

Observable<T>

An observable of the value at index, or defaultValue if out of range.

Type Parameters

T

The element type of the source observable and the default value.