QueryableExtensionMethodsToDictionaryAsyncTSource, TKey Method (IQueryableTSource, FuncTSource, TKey, CancellationToken) |
Creates a Dictionary from the source by executing the source asynchronously, then enumerating it according to a specified key selector function.
Namespace:
SD.LLBLGen.Pro.LinqSupportClasses
Assembly:
SD.LLBLGen.Pro.ORMSupportClasses (in SD.LLBLGen.Pro.ORMSupportClasses.dll) Version: 5.11.0.0 (5.11.23.1114)
Syntax public static Task<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>(
this IQueryable<TSource> source,
Func<TSource, TKey> keySelector,
CancellationToken cancellationToken
)
<ExtensionAttribute>
Public Shared Function ToDictionaryAsync(Of TSource, TKey) (
source As IQueryable(Of TSource),
keySelector As Func(Of TSource, TKey),
cancellationToken As CancellationToken
) As Task(Of Dictionary(Of TKey, TSource))
Parameters
- source
- Type: System.LinqIQueryableTSource
the source - keySelector
- Type: SystemFuncTSource, TKey
the key selector function - cancellationToken
- Type: System.ThreadingCancellationToken
The cancellation token
Type Parameters
- TSource
- the type of the elements in source
- TKey
- the type of the key
Return Value
Type:
TaskDictionaryTKey,
TSourcethe results of source in a new dictionary with the results of the keyselector as keys
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IQueryableTSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Remarks Not usable wrapped inside a Linq query. Use this method to execute a linq query asynchronously
See Also