QueryableExtensions.ToDictionaryAsync Method
Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector function.
Assembly: EntityFramework (in EntityFramework.dll)
QueryableExtensions.ToDictionaryAsync<TSource, TKey> Method (IQueryable<TSource>, Func<TSource, TKey>)
Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector function.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>( this IQueryable<TSource> source, Func<TSource, TKey> keySelector )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
An IQueryable<T> to create a Dictionary<TKey, TValue> from.
- keySelector
-
Type:
System.Func<TSource, TKey>
A function to extract a key from each element.
Return Value
Type: System.Threading.Tasks.Task<Dictionary<TKey, TSource>>A task that represents the asynchronous operation. The task result contains a Dictionary<TKey, TValue> that contains selected keys and values.
Type Parameters
- TSource
The type of the elements of source.
- TKey
The type of the key returned by keySelector .
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.ToDictionaryAsync<TSource, TKey> Method (IQueryable<TSource>, Func<TSource, TKey>, CancellationToken)
Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector function.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>( this IQueryable<TSource> source, Func<TSource, TKey> keySelector, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
An IQueryable<T> to create a Dictionary<TKey, TValue> from.
- keySelector
-
Type:
System.Func<TSource, TKey>
A function to extract a key from each element.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Dictionary<TKey, TSource>>A task that represents the asynchronous operation. The task result contains a Dictionary<TKey, TValue> that contains selected keys and values.
Type Parameters
- TSource
The type of the elements of source.
- TKey
The type of the key returned by keySelector .
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.ToDictionaryAsync<TSource, TKey> Method (IQueryable<TSource>, Func<TSource, TKey>, IEqualityComparer<TKey>)
Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector function and a comparer.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>( this IQueryable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
An IQueryable<T> to create a Dictionary<TKey, TValue> from.
- keySelector
-
Type:
System.Func<TSource, TKey>
A function to extract a key from each element.
- comparer
-
Type:
System.Collections.Generic.IEqualityComparer<TKey>
An IEqualityComparer<T> to compare keys.
Return Value
Type: System.Threading.Tasks.Task<Dictionary<TKey, TSource>>A task that represents the asynchronous operation. The task result contains a Dictionary<TKey, TValue> that contains selected keys and values.
Type Parameters
- TSource
The type of the elements of source.
- TKey
The type of the key returned by keySelector .
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.ToDictionaryAsync<TSource, TKey> Method (IQueryable<TSource>, Func<TSource, TKey>, IEqualityComparer<TKey>, CancellationToken)
Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector function and a comparer.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Dictionary<TKey, TSource>> ToDictionaryAsync<TSource, TKey>( this IQueryable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
An IQueryable<T> to create a Dictionary<TKey, TValue> from.
- keySelector
-
Type:
System.Func<TSource, TKey>
A function to extract a key from each element.
- comparer
-
Type:
System.Collections.Generic.IEqualityComparer<TKey>
An IEqualityComparer<T> to compare keys.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Dictionary<TKey, TSource>>A task that represents the asynchronous operation. The task result contains a Dictionary<TKey, TValue> that contains selected keys and values.
Type Parameters
- TSource
The type of the elements of source.
- TKey
The type of the key returned by keySelector .
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.ToDictionaryAsync<TSource, TKey, TElement> Method (IQueryable<TSource>, Func<TSource, TKey>, Func<TSource, TElement>)
Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector and an element selector function.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>( this IQueryable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
An IQueryable<T> to create a Dictionary<TKey, TValue> from.
- keySelector
-
Type:
System.Func<TSource, TKey>
A function to extract a key from each element.
- elementSelector
-
Type:
System.Func<TSource, TElement>
A transform function to produce a result element value from each element.
Return Value
Type: System.Threading.Tasks.Task<Dictionary<TKey, TElement>>A task that represents the asynchronous operation. The task result contains a Dictionary<TKey, TValue> that contains values of type TElement selected from the input sequence.
Type Parameters
- TSource
The type of the elements of source.
- TKey
The type of the key returned by keySelector .
- TElement
The type of the value returned by elementSelector.
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.ToDictionaryAsync<TSource, TKey, TElement> Method (IQueryable<TSource>, Func<TSource, TKey>, Func<TSource, TElement>, CancellationToken)
Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector and an element selector function.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>( this IQueryable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
An IQueryable<T> to create a Dictionary<TKey, TValue> from.
- keySelector
-
Type:
System.Func<TSource, TKey>
A function to extract a key from each element.
- elementSelector
-
Type:
System.Func<TSource, TElement>
A transform function to produce a result element value from each element.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Dictionary<TKey, TElement>>A task that represents the asynchronous operation. The task result contains a Dictionary<TKey, TValue> that contains values of type TElement selected from the input sequence.
Type Parameters
- TSource
The type of the elements of source.
- TKey
The type of the key returned by keySelector .
- TElement
The type of the value returned by elementSelector.
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.ToDictionaryAsync<TSource, TKey, TElement> Method (IQueryable<TSource>, Func<TSource, TKey>, Func<TSource, TElement>, IEqualityComparer<TKey>)
Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector function, a comparer, and an element selector function.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>( this IQueryable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
An IQueryable<T> to create a Dictionary<TKey, TValue> from.
- keySelector
-
Type:
System.Func<TSource, TKey>
A function to extract a key from each element.
- elementSelector
-
Type:
System.Func<TSource, TElement>
A transform function to produce a result element value from each element.
- comparer
-
Type:
System.Collections.Generic.IEqualityComparer<TKey>
An IEqualityComparer<T> to compare keys.
Return Value
Type: System.Threading.Tasks.Task<Dictionary<TKey, TElement>>A task that represents the asynchronous operation. The task result contains a Dictionary<TKey, TValue> that contains values of type TElement selected from the input sequence.
Type Parameters
- TSource
The type of the elements of source.
- TKey
The type of the key returned by keySelector .
- TElement
The type of the value returned by elementSelector.
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.ToDictionaryAsync<TSource, TKey, TElement> Method (IQueryable<TSource>, Func<TSource, TKey>, Func<TSource, TElement>, IEqualityComparer<TKey>, CancellationToken)
Creates a Dictionary<TKey, TValue> from an IQueryable<T> by enumerating it asynchronously according to a specified key selector function, a comparer, and an element selector function.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Dictionary<TKey, TElement>> ToDictionaryAsync<TSource, TKey, TElement>( this IQueryable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
An IQueryable<T> to create a Dictionary<TKey, TValue> from.
- keySelector
-
Type:
System.Func<TSource, TKey>
A function to extract a key from each element.
- elementSelector
-
Type:
System.Func<TSource, TElement>
A transform function to produce a result element value from each element.
- comparer
-
Type:
System.Collections.Generic.IEqualityComparer<TKey>
An IEqualityComparer<T> to compare keys.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Dictionary<TKey, TElement>>A task that represents the asynchronous operation. The task result contains a Dictionary<TKey, TValue> that contains values of type TElement selected from the input sequence.
Type Parameters
- TSource
The type of the elements of source.
- TKey
The type of the key returned by keySelector .
- TElement
The type of the value returned by elementSelector.
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.