Back to Devexpress

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

xpo-devexpress-dot-xpo-dot-xpqueryextensions-dot-tolookupasync-2-x28-system-dot-linq-dot-iqueryable-0-system-dot-func-0-1-system-dot-threading-dot-cancellationtoken-x29.md

latest2.8 KB
Original Source

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

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

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

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

Parameters

NameTypeDescription
queryIQueryable<T>

An XPQuery<T> to be enumerated.

| | keySelector | Func<T, TKey> |

A function that acquires each persistent object’s key.

|

Optional Parameters

NameTypeDefaultDescription
cancellationTokenCancellationTokennull

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

|

Type Parameters

Name
T
TKey

Returns

TypeDescription
Task<ILookup<TKey, T>>

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

|

See Also

XPQueryExtensions Class

XPQueryExtensions Members

DevExpress.Xpo Namespace