AsyncEnumerable.GroupBy Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GroupBy<TSource,TKey,TElement,TResult>(IAsyncEnumerable<TSource>, Func<TSource,CancellationToken,ValueTask<TKey>>, Func<TSource, CancellationToken,ValueTask<TElement>>, Func<TKey,IEnumerable<TElement>, CancellationToken,ValueTask<TResult>>, IEqualityComparer<TKey>) |
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Key values are compared by using a specified comparer, and the elements of each group are projected by using a specified function. |
GroupBy<TSource,TKey,TElement,TResult>(IAsyncEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, Func<TKey,IEnumerable<TElement>, TResult>, IEqualityComparer<TKey>) |
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Key values are compared by using a specified comparer, and the elements of each group are projected by using a specified function. |
GroupBy<TSource,TKey,TElement>(IAsyncEnumerable<TSource>, Func<TSource, CancellationToken,ValueTask<TKey>>, Func<TSource,CancellationToken, ValueTask<TElement>>, IEqualityComparer<TKey>) |
Groups the elements of a sequence according to a key selector function. The keys are compared by using a comparer and each group's elements are projected by using a specified function. |
GroupBy<TSource,TKey,TElement>(IAsyncEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>) |
Groups the elements of a sequence according to a key selector function. The keys are compared by using a comparer and each group's elements are projected by using a specified function. |
GroupBy<TSource,TKey,TResult>(IAsyncEnumerable<TSource>, Func<TSource, CancellationToken,ValueTask<TKey>>, Func<TKey,IEnumerable<TSource>, CancellationToken,ValueTask<TResult>>, IEqualityComparer<TKey>) |
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. |
GroupBy<TSource,TKey,TResult>(IAsyncEnumerable<TSource>, Func<TSource,TKey>, Func<TKey,IEnumerable<TSource>,TResult>, IEqualityComparer<TKey>) |
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. |
GroupBy<TSource,TKey>(IAsyncEnumerable<TSource>, Func<TSource,CancellationToken,ValueTask<TKey>>, IEqualityComparer<TKey>) |
Groups the elements of a sequence according to a specified key selector function. |
GroupBy<TSource,TKey>(IAsyncEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>) |
Groups the elements of a sequence according to a specified key selector function. |
GroupBy<TSource,TKey,TElement,TResult>(IAsyncEnumerable<TSource>, Func<TSource,CancellationToken,ValueTask<TKey>>, Func<TSource, CancellationToken,ValueTask<TElement>>, Func<TKey,IEnumerable<TElement>, CancellationToken,ValueTask<TResult>>, IEqualityComparer<TKey>)
- Source:
- GroupBy.cs
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Key values are compared by using a specified comparer, and the elements of each group are projected by using a specified function.
public static System.Collections.Generic.IAsyncEnumerable<TResult> GroupBy<TSource,TKey,TElement,TResult>(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, Func<TKey,System.Collections.Generic.IEnumerable<TElement>,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TResult>> resultSelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member GroupBy : 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>> * Func<'Key, seq<'Element>, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Result>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<'Result>
<Extension()>
Public Function GroupBy(Of TSource, TKey, TElement, TResult) (source As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, CancellationToken, ValueTask(Of TKey)), elementSelector As Func(Of TSource, CancellationToken, ValueTask(Of TElement)), resultSelector As Func(Of TKey, IEnumerable(Of TElement), CancellationToken, ValueTask(Of TResult)), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As IAsyncEnumerable(Of TResult)
Type Parameters
- TSource
The type of the elements of source.
- TKey
The type of the key returned by keySelector
.
- TElement
The type of the elements in each IGrouping<TKey,TElement>.
- TResult
The type of the result value returned by resultSelector
.
Parameters
- source
- IAsyncEnumerable<TSource>
An IAsyncEnumerable<T> of elements to group.
- keySelector
- Func<TSource,CancellationToken,ValueTask<TKey>>
A function to extract the key for each element.
- elementSelector
- Func<TSource,CancellationToken,ValueTask<TElement>>
A function to map each source element to an element in an IGrouping<TKey,TElement>.
- resultSelector
- Func<TKey,IEnumerable<TElement>,CancellationToken,ValueTask<TResult>>
A function to create a result value from each group.
- comparer
- IEqualityComparer<TKey>
An IEqualityComparer<T> to compare keys.
Returns
A collection of elements of type TResult
where each element represents a projection over a group and its key.
Exceptions
resultSelector
is null
.
Applies to
GroupBy<TSource,TKey,TElement,TResult>(IAsyncEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, Func<TKey,IEnumerable<TElement>, TResult>, IEqualityComparer<TKey>)
- Source:
- GroupBy.cs
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Key values are compared by using a specified comparer, and the elements of each group are projected by using a specified function.
public static System.Collections.Generic.IAsyncEnumerable<TResult> GroupBy<TSource,TKey,TElement,TResult>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,TKey> keySelector, Func<TSource,TElement> elementSelector, Func<TKey,System.Collections.Generic.IEnumerable<TElement>,TResult> resultSelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member GroupBy : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, 'Key> * Func<'Source, 'Element> * Func<'Key, seq<'Element>, 'Result> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<'Result>
<Extension()>
Public Function GroupBy(Of TSource, TKey, TElement, TResult) (source As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), elementSelector As Func(Of TSource, TElement), resultSelector As Func(Of TKey, IEnumerable(Of TElement), TResult), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As IAsyncEnumerable(Of TResult)
Type Parameters
- TSource
The type of the elements of source.
- TKey
The type of the key returned by keySelector
.
- TElement
The type of the elements in each IGrouping<TKey,TElement>.
- TResult
The type of the result value returned by resultSelector
.
Parameters
- source
- IAsyncEnumerable<TSource>
An IAsyncEnumerable<T> of elements to group.
- keySelector
- Func<TSource,TKey>
A function to extract the key for each element.
- elementSelector
- Func<TSource,TElement>
A function to map each source element to an element in an IGrouping<TKey,TElement>.
- resultSelector
- Func<TKey,IEnumerable<TElement>,TResult>
A function to create a result value from each group.
- comparer
- IEqualityComparer<TKey>
An IEqualityComparer<T> to compare keys.
Returns
A collection of elements of type TResult
where each element represents a projection over a group and its key.
Exceptions
resultSelector
is null
.
Applies to
GroupBy<TSource,TKey,TElement>(IAsyncEnumerable<TSource>, Func<TSource, CancellationToken,ValueTask<TKey>>, Func<TSource,CancellationToken, ValueTask<TElement>>, IEqualityComparer<TKey>)
- Source:
- GroupBy.cs
Groups the elements of a sequence according to a key selector function. The keys are compared by using a comparer and each group's elements are projected by using a specified function.
public static System.Collections.Generic.IAsyncEnumerable<System.Linq.IGrouping<TKey,TElement>> GroupBy<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);
static member GroupBy : 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.Collections.Generic.IAsyncEnumerable<System.Linq.IGrouping<'Key, 'Element>>
<Extension()>
Public Function GroupBy(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) As IAsyncEnumerable(Of IGrouping(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 elements in the IGrouping<TKey,TElement>.
Parameters
- source
- IAsyncEnumerable<TSource>
An IAsyncEnumerable<T> of elements to group.
- keySelector
- Func<TSource,CancellationToken,ValueTask<TKey>>
A function to extract the key for each element.
- elementSelector
- Func<TSource,CancellationToken,ValueTask<TElement>>
A function to map each source element to an element in an IGrouping<TKey,TElement>.
- comparer
- IEqualityComparer<TKey>
An IEqualityComparer<T> to compare keys.
Returns
An IAsyncEnumerable<T> where each IGrouping<TKey,TElement>
contains a sequence of objects of type TElement
and a key.
Exceptions
elementSelector
is null
.
Applies to
GroupBy<TSource,TKey,TElement>(IAsyncEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)
- Source:
- GroupBy.cs
Groups the elements of a sequence according to a key selector function. The keys are compared by using a comparer and each group's elements are projected by using a specified function.
public static System.Collections.Generic.IAsyncEnumerable<System.Linq.IGrouping<TKey,TElement>> GroupBy<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);
static member GroupBy : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, 'Key> * Func<'Source, 'Element> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<System.Linq.IGrouping<'Key, 'Element>>
<Extension()>
Public Function GroupBy(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) As IAsyncEnumerable(Of IGrouping(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 elements in the IGrouping<TKey,TElement>.
Parameters
- source
- IAsyncEnumerable<TSource>
An IAsyncEnumerable<T> of elements to group.
- keySelector
- Func<TSource,TKey>
A function to extract the key for each element.
- elementSelector
- Func<TSource,TElement>
A function to map each source element to an element in an IGrouping<TKey,TElement>.
- comparer
- IEqualityComparer<TKey>
An IEqualityComparer<T> to compare keys.
Returns
An IAsyncEnumerable<T> where each IGrouping<TKey,TElement>
contains a sequence of objects of type TElement
and a key.
Exceptions
elementSelector
is null
.
Applies to
GroupBy<TSource,TKey,TResult>(IAsyncEnumerable<TSource>, Func<TSource, CancellationToken,ValueTask<TKey>>, Func<TKey,IEnumerable<TSource>, CancellationToken,ValueTask<TResult>>, IEqualityComparer<TKey>)
- Source:
- GroupBy.cs
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key.
public static System.Collections.Generic.IAsyncEnumerable<TResult> GroupBy<TSource,TKey,TResult>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TKey>> keySelector, Func<TKey,System.Collections.Generic.IEnumerable<TSource>,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TResult>> resultSelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member GroupBy : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Key>> * Func<'Key, seq<'Source>, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Result>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<'Result>
<Extension()>
Public Function GroupBy(Of TSource, TKey, TResult) (source As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, CancellationToken, ValueTask(Of TKey)), resultSelector As Func(Of TKey, IEnumerable(Of TSource), CancellationToken, ValueTask(Of TResult)), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As IAsyncEnumerable(Of TResult)
Type Parameters
- TSource
The type of the elements of source.
- TKey
The type of the key returned by keySelector
.
- TResult
The type of the result value returned by resultSelector.
Parameters
- source
- IAsyncEnumerable<TSource>
An IAsyncEnumerable<T> of elements to group.
- keySelector
- Func<TSource,CancellationToken,ValueTask<TKey>>
A function to extract the key for each element.
- resultSelector
- Func<TKey,IEnumerable<TSource>,CancellationToken,ValueTask<TResult>>
A function to create a result value from each group.
- comparer
- IEqualityComparer<TKey>
An IEqualityComparer<T> to compare keys.
Returns
A collection of elements of type TResult
where each element represents
a projection over a group and its key.
Exceptions
resultSelector
is null
.
Applies to
GroupBy<TSource,TKey,TResult>(IAsyncEnumerable<TSource>, Func<TSource,TKey>, Func<TKey,IEnumerable<TSource>,TResult>, IEqualityComparer<TKey>)
- Source:
- GroupBy.cs
Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key.
public static System.Collections.Generic.IAsyncEnumerable<TResult> GroupBy<TSource,TKey,TResult>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,TKey> keySelector, Func<TKey,System.Collections.Generic.IEnumerable<TSource>,TResult> resultSelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member GroupBy : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, 'Key> * Func<'Key, seq<'Source>, 'Result> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<'Result>
<Extension()>
Public Function GroupBy(Of TSource, TKey, TResult) (source As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), resultSelector As Func(Of TKey, IEnumerable(Of TSource), TResult), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As IAsyncEnumerable(Of TResult)
Type Parameters
- TSource
The type of the elements of source.
- TKey
The type of the key returned by keySelector
.
- TResult
The type of the result value returned by resultSelector.
Parameters
- source
- IAsyncEnumerable<TSource>
An IAsyncEnumerable<T> of elements to group.
- keySelector
- Func<TSource,TKey>
A function to extract the key for each element.
- resultSelector
- Func<TKey,IEnumerable<TSource>,TResult>
A function to create a result value from each group.
- comparer
- IEqualityComparer<TKey>
An IEqualityComparer<T> to compare keys.
Returns
A collection of elements of type TResult
where each element represents
a projection over a group and its key.
Exceptions
resultSelector
is null
.
Applies to
GroupBy<TSource,TKey>(IAsyncEnumerable<TSource>, Func<TSource,CancellationToken,ValueTask<TKey>>, IEqualityComparer<TKey>)
- Source:
- GroupBy.cs
Groups the elements of a sequence according to a specified key selector function.
public static System.Collections.Generic.IAsyncEnumerable<System.Linq.IGrouping<TKey,TSource>> GroupBy<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);
static member GroupBy : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Key>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<System.Linq.IGrouping<'Key, 'Source>>
<Extension()>
Public Function GroupBy(Of TSource, TKey) (source As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, CancellationToken, ValueTask(Of TKey)), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As IAsyncEnumerable(Of IGrouping(Of TKey, TSource))
Type Parameters
- TSource
The type of the elements of source.
- TKey
The type of the key returned by keySelector
.
Parameters
- source
- IAsyncEnumerable<TSource>
An IAsyncEnumerable<T> of elements to group.
- keySelector
- Func<TSource,CancellationToken,ValueTask<TKey>>
A function to extract the key for each element.
- comparer
- IEqualityComparer<TKey>
An IEqualityComparer<T> to compare keys.
Returns
An IAsyncEnumerable<T> where each IGrouping<TKey,TElement> contains a sequence of objects and a key.
Exceptions
keySelector
is null
.
Applies to
GroupBy<TSource,TKey>(IAsyncEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)
- Source:
- GroupBy.cs
Groups the elements of a sequence according to a specified key selector function.
public static System.Collections.Generic.IAsyncEnumerable<System.Linq.IGrouping<TKey,TSource>> GroupBy<TSource,TKey>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member GroupBy : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<System.Linq.IGrouping<'Key, 'Source>>
<Extension()>
Public Function GroupBy(Of TSource, TKey) (source As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As IAsyncEnumerable(Of IGrouping(Of TKey, TSource))
Type Parameters
- TSource
The type of the elements of source.
- TKey
The type of the key returned by keySelector
.
Parameters
- source
- IAsyncEnumerable<TSource>
An IAsyncEnumerable<T> of elements to group.
- keySelector
- Func<TSource,TKey>
A function to extract the key for each element.
- comparer
- IEqualityComparer<TKey>
An IEqualityComparer<T> to compare keys.
Returns
An IAsyncEnumerable<T> where each IGrouping<TKey,TElement> contains a sequence of objects and a key.
Exceptions
keySelector
is null
.