DbRawSqlQuery<TElement>.ToDictionaryAsync 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>, IEqualityComparer<TKey>, CancellationToken)
Dictionary<TKey,TValue>通过根据指定的键选择器函数、比较器和元素选择器函数异步枚举查询,从查询中创建 。
[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>>
类型参数
- TKey
返回 keySelector
的键的类型。
- TResult
elementSelector
返回的值的类型。
参数
- keySelector
- Func<TElement,TKey>
用于从每个元素中提取键的函数。
- elementSelector
- Func<TElement,TResult>
用于从每个元素产生结果元素值的转换函数。
- comparer
- IEqualityComparer<TKey>
用于比较键的 IEqualityComparer<T>。
- cancellationToken
- CancellationToken
等待 CancellationToken 任务完成时要观察的 。
返回
表示异步操作的任务。
任务结果包含一个 Dictionary<TKey,TValue> ,其中包含从输入序列中选择的类型 TResult
的值。
- 属性
注解
不支持对同一上下文实例执行多个活动操作。 使用“await”确保在此上下文上调用另一个方法之前已完成所有异步操作。
适用于
ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>, CancellationToken)
Dictionary<TKey,TValue>通过根据指定的键选择器和元素选择器函数异步枚举查询,从查询中创建 。
[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>>
类型参数
- TKey
返回 keySelector
的键的类型。
- TResult
elementSelector
返回的值的类型。
参数
- keySelector
- Func<TElement,TKey>
用于从每个元素中提取键的函数。
- elementSelector
- Func<TElement,TResult>
用于从每个元素产生结果元素值的转换函数。
- cancellationToken
- CancellationToken
等待 CancellationToken 任务完成时要观察的 。
返回
表示异步操作的任务。
任务结果包含一个 Dictionary<TKey,TValue> ,其中包含从查询中选择的 类型的 TResult
值。
- 属性
注解
不支持对同一上下文实例执行多个活动操作。 使用“await”确保在此上下文上调用另一个方法之前已完成所有异步操作。
适用于
ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>, IEqualityComparer<TKey>)
Dictionary<TKey,TValue>通过根据指定的键选择器函数、比较器和元素选择器函数异步枚举查询,从查询中创建 。
[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))
类型参数
- TKey
返回 keySelector
的键的类型。
- TResult
elementSelector
返回的值的类型。
参数
- keySelector
- Func<TElement,TKey>
用于从每个元素中提取键的函数。
- elementSelector
- Func<TElement,TResult>
用于从每个元素产生结果元素值的转换函数。
- comparer
- IEqualityComparer<TKey>
用于比较键的 IEqualityComparer<T>。
返回
表示异步操作的任务。
任务结果包含一个 Dictionary<TKey,TValue> ,其中包含从输入序列中选择的类型 TResult
的值。
- 属性
注解
不支持对同一上下文实例执行多个活动操作。 使用“await”确保在此上下文上调用另一个方法之前已完成所有异步操作。
适用于
ToDictionaryAsync<TKey,TResult>(Func<TElement,TKey>, Func<TElement,TResult>)
Dictionary<TKey,TValue>通过根据指定的键选择器和元素选择器函数异步枚举查询,从查询中创建 。
[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))
类型参数
- TKey
返回 keySelector
的键的类型。
- TResult
elementSelector
返回的值的类型。
参数
- keySelector
- Func<TElement,TKey>
用于从每个元素中提取键的函数。
- elementSelector
- Func<TElement,TResult>
用于从每个元素产生结果元素值的转换函数。
返回
表示异步操作的任务。
任务结果包含一个 Dictionary<TKey,TValue> ,其中包含从查询中选择的 类型的 TResult
值。
- 属性
注解
不支持对同一上下文实例执行多个活动操作。 使用“await”确保在此上下文上调用另一个方法之前已完成所有异步操作。
适用于
ToDictionaryAsync<TKey>(Func<TElement,TKey>, IEqualityComparer<TKey>, CancellationToken)
Dictionary<TKey,TValue>通过根据指定的键选择器函数和比较器异步枚举查询,从查询创建 。
[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>>
类型参数
- TKey
返回 keySelector
的键的类型。
参数
- keySelector
- Func<TElement,TKey>
用于从每个元素中提取键的函数。
- comparer
- IEqualityComparer<TKey>
用于比较键的 IEqualityComparer<T>。
- cancellationToken
- CancellationToken
等待 CancellationToken 任务完成时要观察的 。
返回
表示异步操作的任务。 任务结果包含一个 Dictionary<TKey,TValue> 包含所选键和值的 。
- 属性
注解
不支持对同一上下文实例执行多个活动操作。 使用“await”确保在此上下文上调用另一个方法之前已完成所有异步操作。
适用于
ToDictionaryAsync<TKey>(Func<TElement,TKey>)
Dictionary<TKey,TValue>通过根据指定的键选择器函数异步枚举查询,从查询创建 。
[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))
类型参数
- TKey
返回 keySelector
的键的类型。
参数
- keySelector
- Func<TElement,TKey>
用于从每个元素中提取键的函数。
返回
表示异步操作的任务。 任务结果包含一个 Dictionary<TKey,TValue> 包含所选键和值的 。
- 属性
注解
不支持对同一上下文实例执行多个活动操作。 使用“await”确保在此上下文上调用另一个方法之前已完成所有异步操作。
适用于
ToDictionaryAsync<TKey>(Func<TElement,TKey>, IEqualityComparer<TKey>)
Dictionary<TKey,TValue>通过根据指定的键选择器函数和比较器异步枚举查询,从查询创建 。
[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))
类型参数
- TKey
返回 keySelector
的键的类型。
参数
- keySelector
- Func<TElement,TKey>
用于从每个元素中提取键的函数。
- comparer
- IEqualityComparer<TKey>
用于比较键的 IEqualityComparer<T>。
返回
表示异步操作的任务。 任务结果包含一个 Dictionary<TKey,TValue> 包含所选键和值的 。
- 属性
注解
不支持对同一上下文实例执行多个活动操作。 使用“await”确保在此上下文上调用另一个方法之前已完成所有异步操作。
适用于
ToDictionaryAsync<TKey>(Func<TElement,TKey>, CancellationToken)
Dictionary<TKey,TValue>通过根据指定的键选择器函数异步枚举查询,从查询创建 。
[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>>
类型参数
- TKey
返回 keySelector
的键的类型。
参数
- keySelector
- Func<TElement,TKey>
用于从每个元素中提取键的函数。
- cancellationToken
- CancellationToken
等待 CancellationToken 任务完成时要观察的 。
返回
表示异步操作的任务。 任务结果包含一个 Dictionary<TKey,TValue> 包含所选键和值的 。
- 属性
注解
不支持对同一上下文实例执行多个活动操作。 使用“await”确保在此上下文上调用另一个方法之前已完成所有异步操作。
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈