.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

XPQueryExtensions.ToLookupAsync<T, TKey>(IQueryable<T>, Func<T, TKey>, IEqualityComparer<TKey>, CancellationToken) Method

Asynchronously enumerates a query and uses a key selector and a comparer to construct a Lookup<TKey,TElement>.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v20.1.dll


public static Task<ILookup<TKey, T>> ToLookupAsync<T, TKey>(
    this IQueryable<T> query,
    Func<T, TKey> keySelector,
    IEqualityComparer<TKey> equalityComparer,
    CancellationToken cancellationToken = default(CancellationToken)
Public Shared Function ToLookupAsync(Of T, TKey)(
    query As IQueryable(Of T),
    keySelector As Func(Of T, TKey),
    equalityComparer As IEqualityComparer(Of TKey),
    cancellationToken As CancellationToken = Nothing
) As Task(Of ILookup(Of TKey, T))


Name Type Description
query IQueryable<T>

An XPQuery<T> to be enumerated.

keySelector Func<T, TKey>

A function that acquires each persistent object's key.

equalityComparer IEqualityComparer<TKey>

A function that returns a result value for each persistent object.

Optional Parameters

Name Type Default Description
cancellationToken CancellationToken


A CancellationToken object that delivers a cancellation notice to the running operation.

Type Parameters



Type Description
Task<ILookup<TKey, T>>

A Task that returns a Lookup<TKey,TElement>.

See Also