AsyncEnumerable.ToDictionaryAsync Método

Definição

Sobrecargas

Nome Description
ToDictionaryAsync<TKey,TValue>(IAsyncEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>, CancellationToken)

Cria um Dictionary<TKey,TValue> de acordo com um IAsyncEnumerable<T> comparador de chave especificado.

ToDictionaryAsync<TKey,TValue>(IAsyncEnumerable<ValueTuple<TKey,TValue>>, IEqualityComparer<TKey>, CancellationToken)

Cria um Dictionary<TKey,TValue> de acordo com um IAsyncEnumerable<T> comparador de chave especificado.

ToDictionaryAsync<TSource,TKey,TElement>(IAsyncEnumerable<TSource>, Func<TSource,CancellationToken,ValueTask<TKey>>, Func<TSource, CancellationToken,ValueTask<TElement>>, IEqualityComparer<TKey>, CancellationToken)

Cria um Dictionary<TKey,TValue> a partir de um IAsyncEnumerable<T>"/> de acordo com as funções de seletor de elemento e seletor de elemento especificados.

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

Cria um Dictionary<TKey,TValue> a partir de um IAsyncEnumerable<T>"/> de acordo com as funções de seletor de elemento e seletor de elemento especificados.

ToDictionaryAsync<TSource,TKey>(IAsyncEnumerable<TSource>, Func<TSource, CancellationToken,ValueTask<TKey>>, IEqualityComparer<TKey>, CancellationToken)

Cria um Dictionary<TKey,TValue> de um IAsyncEnumerable<T> de acordo com uma função de seletor de chave especificada.

ToDictionaryAsync<TSource,TKey>(IAsyncEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>, CancellationToken)

Cria um Dictionary<TKey,TValue> de um IAsyncEnumerable<T> de acordo com uma função de seletor de chave especificada.

ToDictionaryAsync<TKey,TValue>(IAsyncEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer<TKey>, CancellationToken)

Origem:
ToDictionaryAsync.cs
Origem:
ToDictionaryAsync.cs
Origem:
ToDictionaryAsync.cs

Cria um Dictionary<TKey,TValue> de acordo com um IAsyncEnumerable<T> comparador de chave especificado.

public static System.Threading.Tasks.ValueTask<System.Collections.Generic.Dictionary<TKey,TValue>> ToDictionaryAsync<TKey,TValue>(this System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>> source, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default, System.Threading.CancellationToken cancellationToken = default);
static member ToDictionaryAsync : System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.KeyValuePair<'Key, 'Value>> * System.Collections.Generic.IEqualityComparer<'Key> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Collections.Generic.Dictionary<'Key, 'Value>>
<Extension()>
Public Function ToDictionaryAsync(Of TKey, TValue) (source As IAsyncEnumerable(Of KeyValuePair(Of TKey, TValue)), Optional comparer As IEqualityComparer(Of TKey) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Dictionary(Of TKey, TValue))

Parâmetros de tipo

TKey

O tipo das chaves de elementos de source

TValue

O tipo dos valores de elementos de source

Parâmetros

source
IAsyncEnumerable<KeyValuePair<TKey,TValue>>

O IAsyncEnumerable<T> a partir do qual criar um Dictionary<TKey,TValue> .

comparer
IEqualityComparer<TKey>

Um IEqualityComparer<T> para comparar chaves.

cancellationToken
CancellationToken

O CancellationToken para monitorar solicitações de cancelamento. O padrão é None.

Retornos

ValueTask<Dictionary<TKey,TValue>>

Um Dictionary<TKey,TValue> que contém chaves e valores de source.

Exceções

source é null.

source contém uma ou mais chaves duplicadas (por meio da tarefa retornada).

Aplica-se a

ToDictionaryAsync<TKey,TValue>(IAsyncEnumerable<ValueTuple<TKey,TValue>>, IEqualityComparer<TKey>, CancellationToken)

Origem:
ToDictionaryAsync.cs
Origem:
ToDictionaryAsync.cs
Origem:
ToDictionaryAsync.cs

Cria um Dictionary<TKey,TValue> de acordo com um IAsyncEnumerable<T> comparador de chave especificado.

public static System.Threading.Tasks.ValueTask<System.Collections.Generic.Dictionary<TKey,TValue>> ToDictionaryAsync<TKey,TValue>(this System.Collections.Generic.IAsyncEnumerable<(TKey Key, TValue Value)> source, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default, System.Threading.CancellationToken cancellationToken = default);
static member ToDictionaryAsync : System.Collections.Generic.IAsyncEnumerable<ValueTuple<'Key, 'Value>> * System.Collections.Generic.IEqualityComparer<'Key> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Collections.Generic.Dictionary<'Key, 'Value>>
<Extension()>
Public Function ToDictionaryAsync(Of TKey, TValue) (source As IAsyncEnumerable(Of ValueTuple(Of TKey, TValue)), Optional comparer As IEqualityComparer(Of TKey) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Dictionary(Of TKey, TValue))

Parâmetros de tipo

TKey

O tipo das chaves de elementos de source

TValue

O tipo dos valores de elementos de source

Parâmetros

source
IAsyncEnumerable<ValueTuple<TKey,TValue>>

O IAsyncEnumerable<T> a partir do qual criar um Dictionary<TKey,TValue> .

comparer
IEqualityComparer<TKey>

Um IEqualityComparer<T> para comparar chaves.

cancellationToken
CancellationToken

O CancellationToken para monitorar solicitações de cancelamento. O padrão é None.

Retornos

ValueTask<Dictionary<TKey,TValue>>

Um Dictionary<TKey,TValue> que contém chaves e valores de source.

Exceções

source é null.

source contém uma ou mais chaves duplicadas (por meio da tarefa retornada).

Aplica-se a

ToDictionaryAsync<TSource,TKey,TElement>(IAsyncEnumerable<TSource>, Func<TSource,CancellationToken,ValueTask<TKey>>, Func<TSource, CancellationToken,ValueTask<TElement>>, IEqualityComparer<TKey>, CancellationToken)

Origem:
ToDictionaryAsync.cs
Origem:
ToDictionaryAsync.cs
Origem:
ToDictionaryAsync.cs

Cria um Dictionary<TKey,TValue> a partir de um IAsyncEnumerable<T>"/> de acordo com as funções de seletor de elemento e seletor de elemento especificados.

public static System.Threading.Tasks.ValueTask<System.Collections.Generic.Dictionary<TKey,TElement>> ToDictionaryAsync<TSource,TKey,TElement>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TKey>> keySelector, Func<TSource,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TElement>> elementSelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default, System.Threading.CancellationToken cancellationToken = default);
static member ToDictionaryAsync : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Key>> * Func<'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Element>> * System.Collections.Generic.IEqualityComparer<'Key> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Collections.Generic.Dictionary<'Key, 'Element>>
<Extension()>
Public Function ToDictionaryAsync(Of TSource, TKey, TElement) (source As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, CancellationToken, ValueTask(Of TKey)), elementSelector As Func(Of TSource, CancellationToken, ValueTask(Of TElement)), Optional comparer As IEqualityComparer(Of TKey) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Dictionary(Of TKey, TElement))

Parâmetros de tipo

TSource

O tipo dos elementos de origem.

TKey

O tipo da chave retornada por keySelector.

TElement

O tipo do valor retornado por elementSelector.

Parâmetros

source
IAsyncEnumerable<TSource>

Um IAsyncEnumerable<T> para criar um Dictionary<TKey,TValue> .

keySelector
Func<TSource,CancellationToken,ValueTask<TKey>>

Uma função para extrair uma chave de cada elemento.

elementSelector
Func<TSource,CancellationToken,ValueTask<TElement>>

Uma função de transformação para produzir um valor de elemento de resultado de cada elemento.

comparer
IEqualityComparer<TKey>

Um IEqualityComparer<T> para comparar chaves.

cancellationToken
CancellationToken

O CancellationToken para monitorar solicitações de cancelamento. O padrão é None.

Retornos

ValueTask<Dictionary<TKey,TElement>>

Um Dictionary<TKey,TValue> que contém valores de tipo TElement selecionados na sequência de entrada.

Exceções

elementSelector é null.

source contém uma ou mais chaves duplicadas (por meio da tarefa retornada).

Aplica-se a

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

Origem:
ToDictionaryAsync.cs
Origem:
ToDictionaryAsync.cs
Origem:
ToDictionaryAsync.cs

Cria um Dictionary<TKey,TValue> a partir de um IAsyncEnumerable<T>"/> de acordo com as funções de seletor de elemento e seletor de elemento especificados.

public static System.Threading.Tasks.ValueTask<System.Collections.Generic.Dictionary<TKey,TElement>> ToDictionaryAsync<TSource,TKey,TElement>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,TKey> keySelector, Func<TSource,TElement> elementSelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default, System.Threading.CancellationToken cancellationToken = default);
static member ToDictionaryAsync : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, 'Key> * Func<'Source, 'Element> * System.Collections.Generic.IEqualityComparer<'Key> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Collections.Generic.Dictionary<'Key, 'Element>>
<Extension()>
Public Function ToDictionaryAsync(Of TSource, TKey, TElement) (source As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), elementSelector As Func(Of TSource, TElement), Optional comparer As IEqualityComparer(Of TKey) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Dictionary(Of TKey, TElement))

Parâmetros de tipo

TSource

O tipo dos elementos de origem.

TKey

O tipo da chave retornada por keySelector.

TElement

O tipo do valor retornado por elementSelector.

Parâmetros

source
IAsyncEnumerable<TSource>

Um IAsyncEnumerable<T> para criar um Dictionary<TKey,TValue> .

keySelector
Func<TSource,TKey>

Uma função para extrair uma chave de cada elemento.

elementSelector
Func<TSource,TElement>

Uma função de transformação para produzir um valor de elemento de resultado de cada elemento.

comparer
IEqualityComparer<TKey>

Um IEqualityComparer<T> para comparar chaves.

cancellationToken
CancellationToken

O CancellationToken para monitorar solicitações de cancelamento. O padrão é None.

Retornos

ValueTask<Dictionary<TKey,TElement>>

Um Dictionary<TKey,TValue> que contém valores de tipo TElement selecionados na sequência de entrada.

Exceções

elementSelector é null.

source contém uma ou mais chaves duplicadas (por meio da tarefa retornada).

Aplica-se a

ToDictionaryAsync<TSource,TKey>(IAsyncEnumerable<TSource>, Func<TSource, CancellationToken,ValueTask<TKey>>, IEqualityComparer<TKey>, CancellationToken)

Origem:
ToDictionaryAsync.cs
Origem:
ToDictionaryAsync.cs
Origem:
ToDictionaryAsync.cs

Cria um Dictionary<TKey,TValue> de um IAsyncEnumerable<T> de acordo com uma função de seletor de chave especificada.

public static System.Threading.Tasks.ValueTask<System.Collections.Generic.Dictionary<TKey,TSource>> ToDictionaryAsync<TSource,TKey>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TKey>> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default, System.Threading.CancellationToken cancellationToken = default);
static member ToDictionaryAsync : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Key>> * System.Collections.Generic.IEqualityComparer<'Key> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Collections.Generic.Dictionary<'Key, 'Source>>
<Extension()>
Public Function ToDictionaryAsync(Of TSource, TKey) (source As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, CancellationToken, ValueTask(Of TKey)), Optional comparer As IEqualityComparer(Of TKey) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Dictionary(Of TKey, TSource))

Parâmetros de tipo

TSource

O tipo dos elementos de origem.

TKey

O tipo das chaves retornadas por keySelector.

Parâmetros

source
IAsyncEnumerable<TSource>

Um IAsyncEnumerable<T> para criar um Dictionary<TKey,TValue> .

keySelector
Func<TSource,CancellationToken,ValueTask<TKey>>

Uma função para extrair uma chave de cada elemento.

comparer
IEqualityComparer<TKey>

Um IEqualityComparer<T> para comparar chaves.

cancellationToken
CancellationToken

O CancellationToken para monitorar solicitações de cancelamento. O padrão é None.

Retornos

ValueTask<Dictionary<TKey,TSource>>

Um Dictionary<TKey,TValue> que contém chaves e valores.

Exceções

keySelector é null.

source contém uma ou mais chaves duplicadas (por meio da tarefa retornada).

Aplica-se a

ToDictionaryAsync<TSource,TKey>(IAsyncEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>, CancellationToken)

Origem:
ToDictionaryAsync.cs
Origem:
ToDictionaryAsync.cs
Origem:
ToDictionaryAsync.cs

Cria um Dictionary<TKey,TValue> de um IAsyncEnumerable<T> de acordo com uma função de seletor de chave especificada.

public static System.Threading.Tasks.ValueTask<System.Collections.Generic.Dictionary<TKey,TSource>> ToDictionaryAsync<TSource,TKey>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default, System.Threading.CancellationToken cancellationToken = default);
static member ToDictionaryAsync : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Collections.Generic.Dictionary<'Key, 'Source>>
<Extension()>
Public Function ToDictionaryAsync(Of TSource, TKey) (source As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), Optional comparer As IEqualityComparer(Of TKey) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Dictionary(Of TKey, TSource))

Parâmetros de tipo

TSource

O tipo dos elementos de origem.

TKey

O tipo das chaves retornadas por keySelector.

Parâmetros

source
IAsyncEnumerable<TSource>

Um IAsyncEnumerable<T> para criar um Dictionary<TKey,TValue> .

keySelector
Func<TSource,TKey>

Uma função para extrair uma chave de cada elemento.

comparer
IEqualityComparer<TKey>

Um IEqualityComparer<T> para comparar chaves.

cancellationToken
CancellationToken

O CancellationToken para monitorar solicitações de cancelamento. O padrão é None.

Retornos

ValueTask<Dictionary<TKey,TSource>>

Um Dictionary<TKey,TValue> que contém chaves e valores.

Exceções

keySelector é null.

source contém uma ou mais chaves duplicadas (por meio da tarefa retornada).

Aplica-se a