Skip to content

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

Qbservable.Distinct(IQbservable) method

Defined in

Type: Qbservable Namespace: System.Reactive.Linq Assembly: System.Reactive.dll

Applies to

netstandard2.0

Overloads

  • 1. public static IQbservable<TSource> Distinct<TSource>(this IQbservable<TSource> source)
  • 2. public static IQbservable<TSource> Distinct<TSource>(this IQbservable<TSource> source, IEqualityComparer<TSource> comparer)
  • 3. public static IQbservable<TSource> Distinct<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  • 4. public static IQbservable<TSource> Distinct<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)

1. Overload

public static IQbservable<TSource> Distinct<TSource>(this IQbservable<TSource> source)

Summary: Returns an observable sequence that contains only distinct elements.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#An observable sequence to retain distinct elements for.

Returns: IQbservable -- An observable sequence only containing the distinct elements from the source sequence.

Remarks

Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.

2. Overload

public static IQbservable<TSource> Distinct<TSource>(this IQbservable<TSource> source, IEqualityComparer<TSource> comparer)

Summary: Returns an observable sequence that contains only distinct elements according to the comparer.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#An observable sequence to retain distinct elements for.
comparerIEqualityComparerEquality comparer for source elements.

Returns: IQbservable -- An observable sequence only containing the distinct elements from the source sequence.

Remarks

Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or comparer is null.

3. Overload

public static IQbservable<TSource> Distinct<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector)

Summary: Returns an observable sequence that contains only distinct elements according to the keySelector.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.
TKeyThe type of the discriminator key computed for each element in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#An observable sequence to retain distinct elements for.
keySelectorExpression>A function to compute the comparison key for each element.

Returns: IQbservable -- An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.

Remarks

Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or keySelector is null.

4. Overload

public static IQbservable<TSource> Distinct<TSource, TKey>(this IQbservable<TSource> source, Expression<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

NameDescription
TSourceThe type of the elements in the source sequence.
TKeyThe type of the discriminator key computed for each element in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#An observable sequence to retain distinct elements for.
keySelectorExpression>A function to compute the comparison key for each element.
comparerIEqualityComparerEquality comparer for source elements.

Returns: IQbservable -- An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.

Remarks

Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or keySelector or comparer is null.