Skip to content

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

Observable.Contains(IObservable, TSource) method

Defined in

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

Applies to

netstandard2.0

Overloads

  • 1. public static IObservable<bool> Contains<TSource>(this IObservable<TSource> source, TSource value)
  • 2. public static IObservable<bool> Contains<TSource>(this IObservable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)

1. Overload

public static IObservable<bool> Contains<TSource>(this IObservable<TSource> source, TSource value)

Summary: Determines whether an observable sequence contains a specified element by using the default equality comparer.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
sourceIObservableAn observable sequence in which to locate a value.
valueTSourceThe value to locate in the source sequence.

Returns: IObservable -- An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value.

Remarks

The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.

2. Overload

public static IObservable<bool> Contains<TSource>(this IObservable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)

Summary: Determines whether an observable sequence contains a specified element by using a specified System.Collections.Generic.IEqualityComparer.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
sourceIObservableAn observable sequence in which to locate a value.
valueTSourceThe value to locate in the source sequence.
comparerIEqualityComparerAn equality comparer to compare elements.

Returns: IObservable -- An observable sequence containing a single element determining whether the source sequence contains an element that has the specified value.

Remarks

The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or comparer is null.