Table of Contents

Class SequenceEqualOperator

Namespace
RxSharp.Operators
Assembly
RxSharp.dll

Implements the SequenceEqual operator. Mirrors rxjs's sequenceEqual.

public static class SequenceEqualOperator
Inheritance
System.Object
SequenceEqualOperator

Methods

SequenceEqual<T>(Observable<T>, Observable<T>, Func<T, T, bool>)

Emits a single boolean indicating whether source and other emit exactly the same sequence of values, in the same order, and complete at the same point — using comparer to compare each pair of values.

public static Observable<bool> SequenceEqual<T>(this Observable<T> source, Observable<T> other, Func<T, T, bool> comparer)

Parameters

source Observable<T>

The first observable to compare.

other Observable<T>

The second observable to compare against.

comparer Func<T, T, bool>

A function that compares a pair of values for equality.

Returns

Observable<bool>

An observable that emits a single boolean, then completes.

Type Parameters

T

The element type shared by both observables.

Remarks

Both sources are buffered independently: a value arriving on one side is compared against the oldest unconsumed value from the other side if one is already waiting, or is itself buffered to wait for the other side to catch up otherwise. A mismatch, or a value arriving after the other side has already completed, emits false immediately and tears down both subscriptions — without waiting for either source to finish. If both sides complete having matched every buffered value, the result emits true. If comparer throws, the exception is forwarded via OnError and both source subscriptions are torn down.

SequenceEqual<T>(Observable<T>, Observable<T>, IEqualityComparer<T>?)

Emits a single boolean indicating whether source and other emit exactly the same sequence of values, in the same order, and complete at the same point — using comparer (or the default equality comparer for T) to compare each pair of values.

public static Observable<bool> SequenceEqual<T>(this Observable<T> source, Observable<T> other, IEqualityComparer<T>? comparer = null)

Parameters

source Observable<T>

The first observable to compare.

other Observable<T>

The second observable to compare against.

comparer IEqualityComparer<T>?

The comparer used to test each pair of values for equality. Defaults to EqualityComparer<T>.Default when null.

Returns

Observable<bool>

An observable that emits a single boolean, then completes.

Type Parameters

T

The element type shared by both observables.