Skip to content

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

Qbservable.ToLookup(IQbservable, Expression>) method

Defined in

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

Applies to

netstandard2.0

Overloads

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

1. Overload

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

Summary: Creates a lookup from an observable sequence according to a specified key selector function.

Type parameters

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

Parameters

NameTypeDescription
source[IQbservable](#An observable sequence to create a lookup for.
keySelectorExpression>A function to extract a key from each element.

Returns: IQbservable> -- An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.

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 keySelector is null.

2. Overload

public static IQbservable<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)

Summary: Creates a lookup from an observable sequence according to a specified key selector function, and a comparer.

Type parameters

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

Parameters

NameTypeDescription
source[IQbservable](#An observable sequence to create a lookup for.
keySelectorExpression>A function to extract a key from each element.
comparerIEqualityComparerAn equality comparer to compare keys.

Returns: IQbservable> -- An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.

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 keySelector or comparer is null.

3. Overload

public static IQbservable<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)

Summary: Creates a lookup from an observable sequence according to a specified key selector function, and an element selector function.

Type parameters

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

Parameters

NameTypeDescription
source[IQbservable](#An observable sequence to create a lookup for.
keySelectorExpression>A function to extract a key from each element.
elementSelectorExpression>A transform function to produce a result element value from each element.

Returns: IQbservable> -- An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.

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 keySelector or elementSelector is null.

4. Overload

public static IQbservable<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IQbservable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer)

Summary: Creates a lookup from an observable sequence according to a specified key selector function, a comparer, and an element selector function.

Type parameters

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

Parameters

NameTypeDescription
source[IQbservable](#An observable sequence to create a lookup for.
keySelectorExpression>A function to extract a key from each element.
elementSelectorExpression>A transform function to produce a result element value from each element.
comparerIEqualityComparerAn equality comparer to compare keys.

Returns: IQbservable> -- An observable sequence containing a single element with a lookup mapping unique key values onto the corresponding source sequence's elements.

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 keySelector or elementSelector or comparer is null.