)} ,System.Collections.Generic.IEqualityComparer{--0})} ,System.Func{--0,--1})} ,System.Func{--0,--1},System.Collections.Generic.IEqualityComparer{--1})}
Observable.Distinct(IObservable) method¶
Defined in
Type: Observable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IObservable<TSource> Distinct<TSource>(this IObservable<TSource> source) - 2.
public static IObservable<TSource> Distinct<TSource>(this IObservable<TSource> source, IEqualityComparer<TSource> comparer) - 3.
public static IObservable<TSource> Distinct<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector) - 4.
public static IObservable<TSource> Distinct<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
1. Overload¶
public static IObservable<TSource> Distinct<TSource>(this IObservable<TSource> source)
Summary: Returns an observable sequence that contains only distinct elements.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | An observable sequence to retain distinct elements for. |
Returns: IObservable
Remarks
Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source is null. |
2. Overload¶
public static IObservable<TSource> Distinct<TSource>(this IObservable<TSource> source, IEqualityComparer<TSource> comparer)
Summary: Returns an observable sequence that contains only distinct elements according to the comparer.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | An observable sequence to retain distinct elements for. |
comparer | IEqualityComparer | Equality comparer for source elements. |
Returns: IObservable
Remarks
Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or comparer is null. |
3. Overload¶
public static IObservable<TSource> Distinct<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector)
Summary: Returns an observable sequence that contains only distinct elements according to the keySelector.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
TKey | The type of the discriminator key computed for each element in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | An observable sequence to retain distinct elements for. |
keySelector | Func | A function to compute the comparison key for each element. |
Returns: IObservable
Remarks
Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or keySelector is null. |
4. Overload¶
public static IObservable<TSource> Distinct<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
Summary: Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
TKey | The type of the discriminator key computed for each element in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | An observable sequence to retain distinct elements for. |
keySelector | Func | A function to compute the comparison key for each element. |
comparer | IEqualityComparer | Equality comparer for source elements. |
Returns: IObservable
Remarks
Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or keySelector or comparer is null. |