Skip to main content
.NET Framework 4.6.2+

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

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

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.2.dll

Declaration

public static Task<ILookup<TKey, TElement>> ToLookupAsync<T, TKey, TElement>(
    this IQueryable<T> query,
    Func<T, TKey> keySelector,
    Func<T, TElement> elementSelector,
    IEqualityComparer<TKey> equalityComparer,
    CancellationToken cancellationToken = default(CancellationToken)
)

Parameters

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.

elementSelector Func<T, TElement>

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

equalityComparer IEqualityComparer<TKey>

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

Optional Parameters

Name Type Default Description
cancellationToken CancellationToken null

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

Type Parameters

Name
T
TKey
TElement

Returns

Type Description
Task<ILookup<TKey, TElement>>

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

See Also