AsyncEnumerable.ToDictionaryAsync Method (System.Linq) (original) (raw)

Definition

Overloads

ToDictionaryAsync<TKey,TValue>(IAsyncEnumerable<KeyValuePair<TKey,TValue>>, IEqualityComparer, CancellationToken) Creates a Dictionary<TKey,TValue> from an IAsyncEnumerable according to specified key comparer.
ToDictionaryAsync<TKey,TValue>(IAsyncEnumerable<ValueTuple<TKey,TValue>>, IEqualityComparer, CancellationToken) Creates a Dictionary<TKey,TValue> from an IAsyncEnumerable according to specified key comparer.
ToDictionaryAsync<TSource,TKey,TElement>(IAsyncEnumerable, Func<TSource,CancellationToken,ValueTask>, Func<TSource, CancellationToken,ValueTask>, IEqualityComparer, CancellationToken) Creates a Dictionary<TKey,TValue> from an IAsyncEnumerable"/> according to specified key selector and element selector functions.
ToDictionaryAsync<TSource,TKey,TElement>(IAsyncEnumerable, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer, CancellationToken) Creates a Dictionary<TKey,TValue> from an IAsyncEnumerable"/> according to specified key selector and element selector functions.
ToDictionaryAsync<TSource,TKey>(IAsyncEnumerable, Func<TSource, CancellationToken,ValueTask>, IEqualityComparer, CancellationToken) Creates a Dictionary<TKey,TValue> from an IAsyncEnumerableaccording to a specified key selector function.
ToDictionaryAsync<TSource,TKey>(IAsyncEnumerable, Func<TSource,TKey>, IEqualityComparer, CancellationToken) Creates a Dictionary<TKey,TValue> from an IAsyncEnumerableaccording to a specified key selector function.

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

Source:

ToDictionaryAsync.cs

Source:

ToDictionaryAsync.cs

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))

Type Parameters

TKey

The type of the keys from elements of source

TValue

The type of the values from elements of source

Parameters

Returns

A Dictionary<TKey,TValue> that contains keys and values from source.

Exceptions

source contains one or more duplicate keys (via the returned task).

Applies to

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

Source:

ToDictionaryAsync.cs

Source:

ToDictionaryAsync.cs

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))

Type Parameters

TKey

The type of the keys from elements of source

TValue

The type of the values from elements of source

Parameters

Returns

A Dictionary<TKey,TValue> that contains keys and values from source.

Exceptions

source contains one or more duplicate keys (via the returned task).

Applies to

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

Source:

ToDictionaryAsync.cs

Source:

ToDictionaryAsync.cs

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))

Type Parameters

TSource

The type of the elements of source.

TKey

The type of the key returned by keySelector.

TElement

The type of the value returned by elementSelector.

Parameters

Returns

A Dictionary<TKey,TValue> that contains values of type TElement selected from the input sequence.

Exceptions

source contains one or more duplicate keys (via the returned task).

Applies to

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

Source:

ToDictionaryAsync.cs

Source:

ToDictionaryAsync.cs

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))

Type Parameters

TSource

The type of the elements of source.

TKey

The type of the key returned by keySelector.

TElement

The type of the value returned by elementSelector.

Parameters

keySelector

Func<TSource,TKey>

A function to extract a key from each element.

elementSelector

Func<TSource,TElement>

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

Returns

A Dictionary<TKey,TValue> that contains values of type TElement selected from the input sequence.

Exceptions

source contains one or more duplicate keys (via the returned task).

Applies to

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

Source:

ToDictionaryAsync.cs

Source:

ToDictionaryAsync.cs

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))

Type Parameters

TSource

The type of the elements of source.

TKey

The type of the keys returned by keySelector.

Parameters

Returns

A Dictionary<TKey,TValue> that contains keys and values.

Exceptions

source contains one or more duplicate keys (via the returned task).

Applies to

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

Source:

ToDictionaryAsync.cs

Source:

ToDictionaryAsync.cs

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))

Type Parameters

TSource

The type of the elements of source.

TKey

The type of the keys returned by keySelector.

Parameters

keySelector

Func<TSource,TKey>

A function to extract a key from each element.

Returns

A Dictionary<TKey,TValue> that contains keys and values.

Exceptions

source contains one or more duplicate keys (via the returned task).

Applies to