,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)
Summary: Returns an observable sequence that emits elements from the source sequence, suppressing consecutive duplicates as determined by a key selector function.
Type parameters
| Name | Description |
|---|---|
T | The type of the elements in the source sequence. |
TKey | The type of the key used to determine whether consecutive elements are considered duplicates. |
Parameters
| Name | Type | Description |
|---|---|---|
this | [IObservableAsync | The source observable sequence. |
keySelector | Func | A function that extracts the comparison key from each element in the source sequence. |
Returns: IObservableAsync
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)
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
| Name | Description |
|---|---|
T | The type of the elements in the source sequence. |
TKey | The type of the key used to determine whether consecutive elements are considered duplicates. |
Parameters
| Name | Type | Description |
|---|---|---|
this | [IObservableAsync | The source observable sequence. |
keySelector | Func | A function that extracts the comparison key from each element in the source sequence. |
equalityComparer | IEqualityComparer | An equality comparer used to compare keys for equality. |
Returns: IObservableAsync
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
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown if keySelector or equalityComparer is null. |