Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
Groups in parallel the elements of a sequence according to a key selector function.
GroupBy<TSource,TKey,TElement,TResult>(ParallelQuery<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,TResult>(ParallelQuery<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, Func<TKey,IEnumerable<TElement>,TResult>) |
Groups in parallel the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The elements of each group are projected by using a specified function. |
GroupBy<TSource,TKey,TElement>(ParallelQuery<TSource>, Func<TSource,TKey>, Func<TSource,TElement>) |
Groups in parallel the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function. |
GroupBy<TSource,TKey,TElement>(ParallelQuery<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>) |
Groups in parallel 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>(ParallelQuery<TSource>, Func<TSource,TKey>, Func<TKey,IEnumerable<TSource>,TResult>) |
Groups in parallel 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>(ParallelQuery<TSource>, Func<TSource,TKey>, Func<TKey,IEnumerable<TSource>,TResult>, IEqualityComparer<TKey>) |
Groups in parallel the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The keys are compared by using a specified comparer. |
GroupBy<TSource,TKey>(ParallelQuery<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>) |
Groups in parallel the elements of a sequence according to a specified key selector function and compares the keys by using a specified IComparer<T>. |
GroupBy<TSource,TKey>(ParallelQuery<TSource>, Func<TSource,TKey>) |
Groups in parallel the elements of a sequence according to a specified key-selector function. |
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:
generic <typename TSource, typename TKey, typename TElement, typename TResult>
[System::Runtime::CompilerServices::Extension]
static System::Linq::ParallelQuery<TResult> ^ GroupBy(System::Linq::ParallelQuery<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);
public static System.Linq.ParallelQuery<TResult> GroupBy<TSource,TKey,TElement,TResult>(this System.Linq.ParallelQuery<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);
public static System.Linq.ParallelQuery<TResult> GroupBy<TSource,TKey,TElement,TResult>(this System.Linq.ParallelQuery<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);
static member GroupBy : System.Linq.ParallelQuery<'Source> * Func<'Source, 'Key> * Func<'Source, 'Element> * Func<'Key, seq<'Element>, 'Result> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Linq.ParallelQuery<'Result>
<Extension()>
Public Function GroupBy(Of TSource, TKey, TElement, TResult) (source As ParallelQuery(Of TSource), keySelector As Func(Of TSource, TKey), elementSelector As Func(Of TSource, TElement), resultSelector As Func(Of TKey, IEnumerable(Of TElement), TResult), comparer As IEqualityComparer(Of TKey)) As ParallelQuery(Of TResult)
The type of the elements of source
.
The type of the key returned by keySelector
.
The type of the elements in each IGrouping{TKey, TElement}.
The type of the result value returned by resultSelector
.
A sequence whose elements to group.
A function to extract the key for each element.
A function to map each source element to an element in an IGrouping{Key, TElement}.
A function to create a result value from each group.
An IEqualityComparer<T> to compare keys.
A sequence of elements of type TResult
where each element represents a projection over a group and its key.
The query was canceled with the token passed in through WithCancellation<TSource>(ParallelQuery<TSource>, CancellationToken).
source
or keySelector
or elementSelector
or resultSelector
is null
(Nothing
in Visual Basic).
One or more exceptions occurred during the evaluation of the query.
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
Groups in parallel the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The elements of each group are projected by using a specified function.
public:
generic <typename TSource, typename TKey, typename TElement, typename TResult>
[System::Runtime::CompilerServices::Extension]
static System::Linq::ParallelQuery<TResult> ^ GroupBy(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, TKey> ^ keySelector, Func<TSource, TElement> ^ elementSelector, Func<TKey, System::Collections::Generic::IEnumerable<TElement> ^, TResult> ^ resultSelector);
public static System.Linq.ParallelQuery<TResult> GroupBy<TSource,TKey,TElement,TResult>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,TKey> keySelector, Func<TSource,TElement> elementSelector, Func<TKey,System.Collections.Generic.IEnumerable<TElement>,TResult> resultSelector);
static member GroupBy : System.Linq.ParallelQuery<'Source> * Func<'Source, 'Key> * Func<'Source, 'Element> * Func<'Key, seq<'Element>, 'Result> -> System.Linq.ParallelQuery<'Result>
<Extension()>
Public Function GroupBy(Of TSource, TKey, TElement, TResult) (source As ParallelQuery(Of TSource), keySelector As Func(Of TSource, TKey), elementSelector As Func(Of TSource, TElement), resultSelector As Func(Of TKey, IEnumerable(Of TElement), TResult)) As ParallelQuery(Of TResult)
The type of the elements of source
.
The type of the key returned by keySelector
.
The type of the elements in each IGrouping{TKey, TElement}.
The type of the result value returned by resultSelector
.
A sequence whose elements to group.
A function to extract the key for each element.
A function to map each source element to an element in an IGrouping<TKey, TElement>.
A function to create a result value from each group.
A sequence of elements of type TResult
where each element represents a projection over a group and its key.
The query was canceled with the token passed in through WithCancellation<TSource>(ParallelQuery<TSource>, CancellationToken).
source
or keySelector
or elementSelector
or resultSelector
is null
(Nothing
in Visual Basic).
One or more exceptions occurred during the evaluation of the query.
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
Groups in parallel the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function.
public:
generic <typename TSource, typename TKey, typename TElement>
[System::Runtime::CompilerServices::Extension]
static System::Linq::ParallelQuery<System::Linq::IGrouping<TKey, TElement> ^> ^ GroupBy(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, TKey> ^ keySelector, Func<TSource, TElement> ^ elementSelector);
public static System.Linq.ParallelQuery<System.Linq.IGrouping<TKey,TElement>> GroupBy<TSource,TKey,TElement>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,TKey> keySelector, Func<TSource,TElement> elementSelector);
static member GroupBy : System.Linq.ParallelQuery<'Source> * Func<'Source, 'Key> * Func<'Source, 'Element> -> System.Linq.ParallelQuery<System.Linq.IGrouping<'Key, 'Element>>
<Extension()>
Public Function GroupBy(Of TSource, TKey, TElement) (source As ParallelQuery(Of TSource), keySelector As Func(Of TSource, TKey), elementSelector As Func(Of TSource, TElement)) As ParallelQuery(Of IGrouping(Of TKey, TElement))
The type of elements of source
.
The type of the key returned by keySelector
.
The type of the elements in the IGrouping<TKey,TElement>.
An OrderedParallelQuery<TSource> that contains elements to sort.
A function to extract a key from an element.
A function to map each source element to an element in an IGrouping<TKey,TElement>.
A sequence of groups that are sorted descending according to TKey
.
The query was canceled with the token passed in through WithCancellation<TSource>(ParallelQuery<TSource>, CancellationToken).
source
or elementSelector
is a null reference (Nothing in Visual Basic).
One or more exceptions occurred during the evaluation of the query.
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
Groups in parallel 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:
generic <typename TSource, typename TKey, typename TElement>
[System::Runtime::CompilerServices::Extension]
static System::Linq::ParallelQuery<System::Linq::IGrouping<TKey, TElement> ^> ^ GroupBy(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, TKey> ^ keySelector, Func<TSource, TElement> ^ elementSelector, System::Collections::Generic::IEqualityComparer<TKey> ^ comparer);
public static System.Linq.ParallelQuery<System.Linq.IGrouping<TKey,TElement>> GroupBy<TSource,TKey,TElement>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,TKey> keySelector, Func<TSource,TElement> elementSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer);
public static System.Linq.ParallelQuery<System.Linq.IGrouping<TKey,TElement>> GroupBy<TSource,TKey,TElement>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,TKey> keySelector, Func<TSource,TElement> elementSelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer);
static member GroupBy : System.Linq.ParallelQuery<'Source> * Func<'Source, 'Key> * Func<'Source, 'Element> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Linq.ParallelQuery<System.Linq.IGrouping<'Key, 'Element>>
<Extension()>
Public Function GroupBy(Of TSource, TKey, TElement) (source As ParallelQuery(Of TSource), keySelector As Func(Of TSource, TKey), elementSelector As Func(Of TSource, TElement), comparer As IEqualityComparer(Of TKey)) As ParallelQuery(Of IGrouping(Of TKey, TElement))
The type of elements of source
.
The type of the key returned by keySelector
.
The type of the elements in the IGrouping.
An OrderedParallelQuery{TSource}that contains elements to sort.
A function to extract a key from an element.
A function to map each source element to an element in an IGrouping.
An IComparer{TSource} to compare keys.
A sequence of groups that are sorted descending according to TKey
.
The query was canceled with the token passed in through WithCancellation<TSource>(ParallelQuery<TSource>, CancellationToken).
source
or elementSelector
is a null reference (Nothing in Visual Basic).
One or more exceptions occurred during the evaluation of the query.
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
Groups in parallel the elements of a sequence according to a specified key selector function and creates a result value from each group and its key.
public:
generic <typename TSource, typename TKey, typename TResult>
[System::Runtime::CompilerServices::Extension]
static System::Linq::ParallelQuery<TResult> ^ GroupBy(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, TKey> ^ keySelector, Func<TKey, System::Collections::Generic::IEnumerable<TSource> ^, TResult> ^ resultSelector);
public static System.Linq.ParallelQuery<TResult> GroupBy<TSource,TKey,TResult>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,TKey> keySelector, Func<TKey,System.Collections.Generic.IEnumerable<TSource>,TResult> resultSelector);
static member GroupBy : System.Linq.ParallelQuery<'Source> * Func<'Source, 'Key> * Func<'Key, seq<'Source>, 'Result> -> System.Linq.ParallelQuery<'Result>
<Extension()>
Public Function GroupBy(Of TSource, TKey, TResult) (source As ParallelQuery(Of TSource), keySelector As Func(Of TSource, TKey), resultSelector As Func(Of TKey, IEnumerable(Of TSource), TResult)) As ParallelQuery(Of TResult)
The type of the elements of source
.
The type of the key returned by keySelector
.
The type of the result value returned by resultSelector
.
A sequence whose elements to group.
A function to extract the key for each element.
A function to create a result value from each group.
A sequence of elements of type TResult
where each element represents a projection over a group and its key.
The query was canceled with the token passed in through WithCancellation<TSource>(ParallelQuery<TSource>, CancellationToken).
source
or resultSelector
is a null reference (Nothing in Visual Basic).
One or more exceptions occurred during the evaluation of the query.
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
Groups in parallel the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The keys are compared by using a specified comparer.
public:
generic <typename TSource, typename TKey, typename TResult>
[System::Runtime::CompilerServices::Extension]
static System::Linq::ParallelQuery<TResult> ^ GroupBy(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, TKey> ^ keySelector, Func<TKey, System::Collections::Generic::IEnumerable<TSource> ^, TResult> ^ resultSelector, System::Collections::Generic::IEqualityComparer<TKey> ^ comparer);
public static System.Linq.ParallelQuery<TResult> GroupBy<TSource,TKey,TResult>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,TKey> keySelector, Func<TKey,System.Collections.Generic.IEnumerable<TSource>,TResult> resultSelector, System.Collections.Generic.IEqualityComparer<TKey> comparer);
public static System.Linq.ParallelQuery<TResult> GroupBy<TSource,TKey,TResult>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,TKey> keySelector, Func<TKey,System.Collections.Generic.IEnumerable<TSource>,TResult> resultSelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer);
static member GroupBy : System.Linq.ParallelQuery<'Source> * Func<'Source, 'Key> * Func<'Key, seq<'Source>, 'Result> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Linq.ParallelQuery<'Result>
<Extension()>
Public Function GroupBy(Of TSource, TKey, TResult) (source As ParallelQuery(Of TSource), keySelector As Func(Of TSource, TKey), resultSelector As Func(Of TKey, IEnumerable(Of TSource), TResult), comparer As IEqualityComparer(Of TKey)) As ParallelQuery(Of TResult)
The type of the elements of source
.
The type of the key returned by keySelector
.
The type of the result value returned by resultSelector
.
A sequence whose elements to group.
A function to extract the key for each element.
A function to create a result value from each group.
An IEqualityComparer<T> to compare keys.
A sequence of groups.
The query was canceled with the token passed in through WithCancellation<TSource>(ParallelQuery<TSource>, CancellationToken).
source
or resultSelector
is a null reference (Nothing in Visual Basic).
One or more exceptions occurred during the evaluation of the query.
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
Groups in parallel the elements of a sequence according to a specified key selector function and compares the keys by using a specified IComparer<T>.
public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
static System::Linq::ParallelQuery<System::Linq::IGrouping<TKey, TSource> ^> ^ GroupBy(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, TKey> ^ keySelector, System::Collections::Generic::IEqualityComparer<TKey> ^ comparer);
public static System.Linq.ParallelQuery<System.Linq.IGrouping<TKey,TSource>> GroupBy<TSource,TKey>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey> comparer);
public static System.Linq.ParallelQuery<System.Linq.IGrouping<TKey,TSource>> GroupBy<TSource,TKey>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer);
static member GroupBy : System.Linq.ParallelQuery<'Source> * Func<'Source, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Linq.ParallelQuery<System.Linq.IGrouping<'Key, 'Source>>
<Extension()>
Public Function GroupBy(Of TSource, TKey) (source As ParallelQuery(Of TSource), keySelector As Func(Of TSource, TKey), comparer As IEqualityComparer(Of TKey)) As ParallelQuery(Of IGrouping(Of TKey, TSource))
The type of elements of source
.
The type of the key returned by keySelector
.
An OrderedParallelQuery<TSource> that contains elements to sort.
A function to extract a key from an element.
An IComparer<T> to compare keys.
A sequence of groups that are sorted descending according to TKey
.
The query was canceled with the token passed in through WithCancellation<TSource>(ParallelQuery<TSource>, CancellationToken).
source
is a null reference (Nothing in Visual Basic).
One or more exceptions occurred during the evaluation of the query.
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
Groups in parallel the elements of a sequence according to a specified key-selector function.
public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
static System::Linq::ParallelQuery<System::Linq::IGrouping<TKey, TSource> ^> ^ GroupBy(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, TKey> ^ keySelector);
public static System.Linq.ParallelQuery<System.Linq.IGrouping<TKey,TSource>> GroupBy<TSource,TKey>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,TKey> keySelector);
static member GroupBy : System.Linq.ParallelQuery<'Source> * Func<'Source, 'Key> -> System.Linq.ParallelQuery<System.Linq.IGrouping<'Key, 'Source>>
<Extension()>
Public Function GroupBy(Of TSource, TKey) (source As ParallelQuery(Of TSource), keySelector As Func(Of TSource, TKey)) As ParallelQuery(Of IGrouping(Of TKey, TSource))
The type of elements of source
.
The type of the key returned by keySelector
.
An OrderedParallelQuery<TSource> that contains elements to sort.
A function to extract a key from an element.
A sequence of groups that are sorted in descending order according to TKey
.
The query was canceled with the token passed in through WithCancellation<TSource>(ParallelQuery<TSource>, CancellationToken).
source
or keySelector
is a null reference (Nothing in Visual Basic).
One or more exceptions occurred during the evaluation of the query.
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in