Share via


DbRawSqlQuery<TElement>.ToDictionaryAsync Method

Definition

Overloads

ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>, IEqualityComparer<TKey>, CancellationToken)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function, a comparer, and an element selector function.

ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>, CancellationToken)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector and an element selector function.

ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>, IEqualityComparer<TKey>)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function, a comparer, and an element selector function.

ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector and an element selector function.

ToDictionaryAsync<TKey>(Func<TElement,TKey>, IEqualityComparer<TKey>, CancellationToken)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function and a comparer.

ToDictionaryAsync<TKey>(Func<TElement,TKey>)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function.

ToDictionaryAsync<TKey>(Func<TElement,TKey>, IEqualityComparer<TKey>)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function and a comparer.

ToDictionaryAsync<TKey>(Func<TElement,TKey>, CancellationToken)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function.

ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>, IEqualityComparer<TKey>, CancellationToken)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function, a comparer, and an element selector function.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<TKey,TResult>> ToDictionaryAsync<TKey,TResult> (Func<TElement,TKey> keySelector, Func<TElement,TResult> elementSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer, System.Threading.CancellationToken cancellationToken);
member this.ToDictionaryAsync : Func<'Element, 'Key> * Func<'Element, 'Result> * System.Collections.Generic.IEqualityComparer<'Key> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<'Key, 'Result>>

Type Parameters

TKey

The type of the key returned by keySelector .

TResult

The type of the value returned by elementSelector.

Parameters

keySelector
Func<TElement,TKey>

A function to extract a key from each element.

elementSelector
Func<TElement,TResult>

A transform function to produce a result element value from each element.

comparer
IEqualityComparer<TKey>

An IEqualityComparer<T> to compare keys.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

Task<Dictionary<TKey,TResult>>

A task that represents the asynchronous operation. The task result contains a Dictionary<TKey,TValue> that contains values of type TResult selected from the input sequence.

Attributes

Remarks

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.

Applies to

ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>, CancellationToken)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector and an element selector function.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<TKey,TResult>> ToDictionaryAsync<TKey,TResult> (Func<TElement,TKey> keySelector, Func<TElement,TResult> elementSelector, System.Threading.CancellationToken cancellationToken);
member this.ToDictionaryAsync : Func<'Element, 'Key> * Func<'Element, 'Result> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<'Key, 'Result>>

Type Parameters

TKey

The type of the key returned by keySelector .

TResult

The type of the value returned by elementSelector.

Parameters

keySelector
Func<TElement,TKey>

A function to extract a key from each element.

elementSelector
Func<TElement,TResult>

A transform function to produce a result element value from each element.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

Task<Dictionary<TKey,TResult>>

A task that represents the asynchronous operation. The task result contains a Dictionary<TKey,TValue> that contains values of type TResult selected from the query.

Attributes

Remarks

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.

Applies to

ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>, IEqualityComparer<TKey>)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function, a comparer, and an element selector function.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<TKey,TResult>> ToDictionaryAsync<TKey,TResult> (Func<TElement,TKey> keySelector, Func<TElement,TResult> elementSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer);
member this.ToDictionaryAsync : Func<'Element, 'Key> * Func<'Element, 'Result> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<'Key, 'Result>>
Public Function ToDictionaryAsync(Of TKey, TResult) (keySelector As Func(Of TElement, TKey), elementSelector As Func(Of TElement, TResult), comparer As IEqualityComparer(Of TKey)) As Task(Of Dictionary(Of TKey, TResult))

Type Parameters

TKey

The type of the key returned by keySelector .

TResult

The type of the value returned by elementSelector.

Parameters

keySelector
Func<TElement,TKey>

A function to extract a key from each element.

elementSelector
Func<TElement,TResult>

A transform function to produce a result element value from each element.

comparer
IEqualityComparer<TKey>

An IEqualityComparer<T> to compare keys.

Returns

Task<Dictionary<TKey,TResult>>

A task that represents the asynchronous operation. The task result contains a Dictionary<TKey,TValue> that contains values of type TResult selected from the input sequence.

Attributes

Remarks

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.

Applies to

ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector and an element selector function.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<TKey,TResult>> ToDictionaryAsync<TKey,TResult> (Func<TElement,TKey> keySelector, Func<TElement,TResult> elementSelector);
member this.ToDictionaryAsync : Func<'Element, 'Key> * Func<'Element, 'Result> -> System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<'Key, 'Result>>
Public Function ToDictionaryAsync(Of TKey, TResult) (keySelector As Func(Of TElement, TKey), elementSelector As Func(Of TElement, TResult)) As Task(Of Dictionary(Of TKey, TResult))

Type Parameters

TKey

The type of the key returned by keySelector .

TResult

The type of the value returned by elementSelector.

Parameters

keySelector
Func<TElement,TKey>

A function to extract a key from each element.

elementSelector
Func<TElement,TResult>

A transform function to produce a result element value from each element.

Returns

Task<Dictionary<TKey,TResult>>

A task that represents the asynchronous operation. The task result contains a Dictionary<TKey,TValue> that contains values of type TResult selected from the query.

Attributes

Remarks

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.

Applies to

ToDictionaryAsync<TKey>(Func<TElement,TKey>, IEqualityComparer<TKey>, CancellationToken)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function and a comparer.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<TKey,TElement>> ToDictionaryAsync<TKey> (Func<TElement,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey> comparer, System.Threading.CancellationToken cancellationToken);
member this.ToDictionaryAsync : Func<'Element, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<'Key, 'Element>>

Type Parameters

TKey

The type of the key returned by keySelector .

Parameters

keySelector
Func<TElement,TKey>

A function to extract a key from each element.

comparer
IEqualityComparer<TKey>

An IEqualityComparer<T> to compare keys.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

Task<Dictionary<TKey,TElement>>

A task that represents the asynchronous operation. The task result contains a Dictionary<TKey,TValue> that contains selected keys and values.

Attributes

Remarks

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.

Applies to

ToDictionaryAsync<TKey>(Func<TElement,TKey>)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<TKey,TElement>> ToDictionaryAsync<TKey> (Func<TElement,TKey> keySelector);
member this.ToDictionaryAsync : Func<'Element, 'Key> -> System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<'Key, 'Element>>
Public Function ToDictionaryAsync(Of TKey) (keySelector As Func(Of TElement, TKey)) As Task(Of Dictionary(Of TKey, TElement))

Type Parameters

TKey

The type of the key returned by keySelector .

Parameters

keySelector
Func<TElement,TKey>

A function to extract a key from each element.

Returns

Task<Dictionary<TKey,TElement>>

A task that represents the asynchronous operation. The task result contains a Dictionary<TKey,TValue> that contains selected keys and values.

Attributes

Remarks

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.

Applies to

ToDictionaryAsync<TKey>(Func<TElement,TKey>, IEqualityComparer<TKey>)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function and a comparer.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<TKey,TElement>> ToDictionaryAsync<TKey> (Func<TElement,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey> comparer);
member this.ToDictionaryAsync : Func<'Element, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<'Key, 'Element>>
Public Function ToDictionaryAsync(Of TKey) (keySelector As Func(Of TElement, TKey), comparer As IEqualityComparer(Of TKey)) As Task(Of Dictionary(Of TKey, TElement))

Type Parameters

TKey

The type of the key returned by keySelector .

Parameters

keySelector
Func<TElement,TKey>

A function to extract a key from each element.

comparer
IEqualityComparer<TKey>

An IEqualityComparer<T> to compare keys.

Returns

Task<Dictionary<TKey,TElement>>

A task that represents the asynchronous operation. The task result contains a Dictionary<TKey,TValue> that contains selected keys and values.

Attributes

Remarks

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.

Applies to

ToDictionaryAsync<TKey>(Func<TElement,TKey>, CancellationToken)

Creates a Dictionary<TKey,TValue> from the query by enumerating it asynchronously according to a specified key selector function.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<TKey,TElement>> ToDictionaryAsync<TKey> (Func<TElement,TKey> keySelector, System.Threading.CancellationToken cancellationToken);
member this.ToDictionaryAsync : Func<'Element, 'Key> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<'Key, 'Element>>

Type Parameters

TKey

The type of the key returned by keySelector .

Parameters

keySelector
Func<TElement,TKey>

A function to extract a key from each element.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

Task<Dictionary<TKey,TElement>>

A task that represents the asynchronous operation. The task result contains a Dictionary<TKey,TValue> that contains selected keys and values.

Attributes

Remarks

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.

Applies to