共用方式為


AsyncEnumerable<TResult>.ToDictionaryAsync 方法

定義

多載

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

Dictionary<TKey,TValue>根據指定的索引鍵選取器和元素選取器函式,以非同步方式列舉,從這個 AsyncEnumerable<TResult> 建立 。

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

Dictionary<TKey,TValue>根據指定的索引鍵選取器函式、比較子和元素選取器函式,以非同步方式列舉,從這個 AsyncEnumerable<TResult> 建立 。

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

Dictionary<TKey,TValue>根據指定的索引鍵選取器函式,以非同步方式列舉,從這個 AsyncEnumerable<TResult> 建立 。

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

Dictionary<TKey,TValue>根據指定的索引鍵選取器函式和比較子,以非同步方式列舉,從這個 AsyncEnumerable<TResult> 建立 。

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

Dictionary<TKey,TValue>根據指定的索引鍵選取器和元素選取器函式,以非同步方式列舉,從這個 AsyncEnumerable<TResult> 建立 。

public System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<TKey,TElement>> ToDictionaryAsync<TKey,TElement> (Func<TResult,TKey> keySelector, Func<TResult,TElement> elementSelector, System.Threading.CancellationToken cancellationToken = default);
member this.ToDictionaryAsync : Func<'Result, 'Key> * Func<'Result, 'Element> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<'Key, 'Element>>
Public Function ToDictionaryAsync(Of TKey, TElement) (keySelector As Func(Of TResult, TKey), elementSelector As Func(Of TResult, TElement), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Dictionary(Of TKey, TElement))

類型參數

TKey

keySelector 傳回之索引鍵的類型。

TElement

elementSelector 所傳回值的型別。

參數

keySelector
Func<TResult,TKey>

用來從各個項目擷取索引鍵的函式。

elementSelector
Func<TResult,TElement>

用來從每個項目產生結果項目值的轉換函式。

cancellationToken
CancellationToken

等候 CancellationToken 工作完成時要觀察的 。

傳回

Task<Dictionary<TKey,TElement>>

代表非同步作業的工作。 工作結果包含 , Dictionary<TKey,TValue> 其中包含從輸入序列選取的類型 TElement 值。

備註

不支援相同內容實例上的多個作用中作業。 使用 'await' 來確保任何非同步作業都已完成,然後再在此內容上呼叫另一個方法。

適用於

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

Dictionary<TKey,TValue>根據指定的索引鍵選取器函式、比較子和元素選取器函式,以非同步方式列舉,從這個 AsyncEnumerable<TResult> 建立 。

public System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<TKey,TElement>> ToDictionaryAsync<TKey,TElement> (Func<TResult,TKey> keySelector, Func<TResult,TElement> elementSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer, System.Threading.CancellationToken cancellationToken = default);
member this.ToDictionaryAsync : Func<'Result, 'Key> * Func<'Result, 'Element> * System.Collections.Generic.IEqualityComparer<'Key> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<'Key, 'Element>>
Public Function ToDictionaryAsync(Of TKey, TElement) (keySelector As Func(Of TResult, TKey), elementSelector As Func(Of TResult, TElement), comparer As IEqualityComparer(Of TKey), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Dictionary(Of TKey, TElement))

類型參數

TKey

keySelector 傳回之索引鍵的類型。

TElement

elementSelector 所傳回值的型別。

參數

keySelector
Func<TResult,TKey>

用來從各個項目擷取索引鍵的函式。

elementSelector
Func<TResult,TElement>

用來從每個項目產生結果項目值的轉換函式。

comparer
IEqualityComparer<TKey>

用來比較金鑰的 IEqualityComparer<T>

cancellationToken
CancellationToken

等候 CancellationToken 工作完成時要觀察的 。

傳回

Task<Dictionary<TKey,TElement>>

代表非同步作業的工作。 工作結果包含 , Dictionary<TKey,TValue> 其中包含從輸入序列選取的類型 TElement 值。

備註

不支援相同內容實例上的多個作用中作業。 使用 'await' 來確保任何非同步作業都已完成,然後再在此內容上呼叫另一個方法。

適用於

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

Dictionary<TKey,TValue>根據指定的索引鍵選取器函式,以非同步方式列舉,從這個 AsyncEnumerable<TResult> 建立 。

public System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<TKey,TResult>> ToDictionaryAsync<TKey> (Func<TResult,TKey> keySelector, System.Threading.CancellationToken cancellationToken = default);
member this.ToDictionaryAsync : Func<'Result, 'Key> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<'Key, 'Result>>
Public Function ToDictionaryAsync(Of TKey) (keySelector As Func(Of TResult, TKey), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Dictionary(Of TKey, TResult))

類型參數

TKey

keySelector 傳回之索引鍵的類型。

參數

keySelector
Func<TResult,TKey>

用來從各個項目擷取索引鍵的函式。

cancellationToken
CancellationToken

等候 CancellationToken 工作完成時要觀察的 。

傳回

Task<Dictionary<TKey,TResult>>

代表非同步作業的工作。 工作結果包含 Dictionary<TKey,TValue> ,其中包含選取的索引鍵和值。

備註

不支援相同內容實例上的多個作用中作業。 使用 'await' 來確保任何非同步作業都已完成,然後再在此內容上呼叫另一個方法。

適用於

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

Dictionary<TKey,TValue>根據指定的索引鍵選取器函式和比較子,以非同步方式列舉,從這個 AsyncEnumerable<TResult> 建立 。

public System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<TKey,TResult>> ToDictionaryAsync<TKey> (Func<TResult,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey> comparer, System.Threading.CancellationToken cancellationToken = default);
member this.ToDictionaryAsync : Func<'Result, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<'Key, 'Result>>
Public Function ToDictionaryAsync(Of TKey) (keySelector As Func(Of TResult, TKey), comparer As IEqualityComparer(Of TKey), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Dictionary(Of TKey, TResult))

類型參數

TKey

keySelector 傳回之索引鍵的類型。

參數

keySelector
Func<TResult,TKey>

用來從各個項目擷取索引鍵的函式。

comparer
IEqualityComparer<TKey>

用來比較金鑰的 IEqualityComparer<T>

cancellationToken
CancellationToken

等候 CancellationToken 工作完成時要觀察的 。

傳回

Task<Dictionary<TKey,TResult>>

代表非同步作業的工作。 工作結果包含 Dictionary<TKey,TValue> ,其中包含選取的索引鍵和值。

備註

不支援相同內容實例上的多個作用中作業。 使用 'await' 來確保任何非同步作業都已完成,然後再在此內容上呼叫另一個方法。

適用於