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
A CancellationToken 在等待任務完成時觀察。
傳回
一個代表非同步操作的任務。
任務結果包含 a Dictionary<TKey,TValue> ,該 包含從輸入序列中選擇的值 TResult 。
- 屬性
備註
不支援在同一上下文實例上進行多個主動操作。 在此上下文中呼叫其他方法前,請使用「wait」以確保所有非同步操作已完成。
適用於
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
A CancellationToken 在等待任務完成時觀察。
傳回
一個代表非同步操作的任務。
任務結果包含 a Dictionary<TKey,TValue> ,該 包含從查詢中選取的類型 TResult 值。
- 屬性
備註
不支援在同一上下文實例上進行多個主動操作。 在此上下文中呼叫其他方法前,請使用「wait」以確保所有非同步操作已完成。
適用於
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> 比較鑰匙。
傳回
一個代表非同步操作的任務。
任務結果包含 a Dictionary<TKey,TValue> ,該 包含從輸入序列中選擇的值 TResult 。
- 屬性
備註
不支援在同一上下文實例上進行多個主動操作。 在此上下文中呼叫其他方法前,請使用「wait」以確保所有非同步操作已完成。
適用於
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>
一個轉換函數,從每個元素產生結果元素值。
傳回
一個代表非同步操作的任務。
任務結果包含 a Dictionary<TKey,TValue> ,該 包含從查詢中選取的類型 TResult 值。
- 屬性
備註
不支援在同一上下文實例上進行多個主動操作。 在此上下文中呼叫其他方法前,請使用「wait」以確保所有非同步操作已完成。
適用於
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
A CancellationToken 在等待任務完成時觀察。
傳回
一個代表非同步操作的任務。 任務結果包含 Dictionary<TKey,TValue> 包含選取的鍵與值。
- 屬性
備註
不支援在同一上下文實例上進行多個主動操作。 在此上下文中呼叫其他方法前,請使用「wait」以確保所有非同步操作已完成。
適用於
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> 包含選取的鍵與值。
- 屬性
備註
不支援在同一上下文實例上進行多個主動操作。 在此上下文中呼叫其他方法前,請使用「wait」以確保所有非同步操作已完成。
適用於
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> 包含選取的鍵與值。
- 屬性
備註
不支援在同一上下文實例上進行多個主動操作。 在此上下文中呼叫其他方法前,請使用「wait」以確保所有非同步操作已完成。
適用於
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
A CancellationToken 在等待任務完成時觀察。
傳回
一個代表非同步操作的任務。 任務結果包含 Dictionary<TKey,TValue> 包含選取的鍵與值。
- 屬性
備註
不支援在同一上下文實例上進行多個主動操作。 在此上下文中呼叫其他方法前,請使用「wait」以確保所有非同步操作已完成。