Skip to content

,System.Func{--0,--1})} ,System.Func{--0,--1},System.Collections.Generic.IEqualityComparer{--1})}

ObservableAsync.DistinctUntilChangedBy(IObservableAsync, Func) method

Defined in

Type: ObservableAsync Namespace: ReactiveUI.Extensions.Async Assembly: ReactiveUI.Extensions.dll

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481

Overloads

  • 1. public static IObservableAsync<T> DistinctUntilChangedBy<T, TKey>(this IObservableAsync<T> @this, Func<T, TKey> keySelector)
  • 2. public static IObservableAsync<T> DistinctUntilChangedBy<T, TKey>(this IObservableAsync<T> @this, Func<T, TKey> keySelector, IEqualityComparer<TKey> equalityComparer)

1. Overload

public static IObservableAsync<T> DistinctUntilChangedBy<T, TKey>(this IObservableAsync<T> @this, Func<T, TKey> keySelector)

View source

Summary: Returns an observable sequence that emits elements from the source sequence, suppressing consecutive duplicates as determined by a key selector function.

Type parameters

NameDescription
TThe type of the elements in the source sequence.
TKeyThe type of the key used to determine whether consecutive elements are considered duplicates.

Parameters

NameTypeDescription
this[IObservableAsync](#The source observable sequence.
keySelectorFuncA function that extracts the comparison key from each element in the source sequence.

Returns: IObservableAsync -- An observable sequence that contains only the elements from the source sequence that are not consecutive duplicates according to the specified key.

Remarks

The comparison of keys uses the default equality comparer for the type TKey. Only consecutive duplicate elements are suppressed; non-consecutive duplicates are not affected.

2. Overload

public static IObservableAsync<T> DistinctUntilChangedBy<T, TKey>(this IObservableAsync<T> @this, Func<T, TKey> keySelector, IEqualityComparer<TKey> equalityComparer)

View source

Summary: Returns an observable sequence that emits elements from the source sequence, suppressing consecutive duplicates as determined by a key selector and equality comparer.

Type parameters

NameDescription
TThe type of the elements in the source sequence.
TKeyThe type of the key used to determine whether consecutive elements are considered duplicates.

Parameters

NameTypeDescription
this[IObservableAsync](#The source observable sequence.
keySelectorFuncA function that extracts the comparison key from each element in the source sequence.
equalityComparerIEqualityComparerAn equality comparer used to compare keys for equality.

Returns: IObservableAsync -- An observable sequence that contains only the elements from the source sequence that are not consecutive duplicates according to the specified key and comparer.

Remarks

The first element in the sequence is always emitted. Subsequent elements are emitted only if their key, as determined by keySelector, is not equal to the key of the immediately preceding element, as determined by equalityComparer.

Exceptions

TypeCondition
System.ArgumentNullExceptionThrown if keySelector or equalityComparer is null.