Επεξεργασία

Κοινή χρήση μέσω


ParallelEnumerable.GroupBy Method

Definition

Groups in parallel the elements of a sequence according to a key selector function.

Overloads

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.

GroupBy<TSource,TKey,TElement,TResult>(ParallelQuery<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, Func<TKey,IEnumerable<TElement>, TResult>, IEqualityComparer<TKey>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.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:
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)

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
ParallelQuery<TSource>

A sequence whose 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{Key, 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

ParallelQuery<TResult>

A sequence of elements of type TResult where each element represents a projection over a group and its key.

Exceptions

source or action or keySelector or elementSelector or resultSelector is null (Nothing in Visual Basic).

One or more exceptions occurred during the evaluation of the query.

See also

Applies to

GroupBy<TSource,TKey,TElement,TResult>(ParallelQuery<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, Func<TKey,IEnumerable<TElement>,TResult>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

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)

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
ParallelQuery<TSource>

A sequence whose 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.

Returns

ParallelQuery<TResult>

A sequence of elements of type TResult where each element represents a projection over a group and its key.

Exceptions

source or action or keySelector or elementSelector or resultSelector is null (Nothing in Visual Basic).

One or more exceptions occurred during the evaluation of the query.

See also

Applies to

GroupBy<TSource,TKey,TElement>(ParallelQuery<TSource>, Func<TSource,TKey>, Func<TSource,TElement>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

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

Type Parameters

TSource

The type of 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
ParallelQuery<TSource>

An OrderedParallelQuery<TSource> that contains elements to sort.

keySelector
Func<TSource,TKey>

A function to extract a key from an element.

elementSelector
Func<TSource,TElement>

A function to map each source element to an element in an IGrouping<TKey,TElement>.

Returns

ParallelQuery<IGrouping<TKey,TElement>>

A sequence of groups that are sorted descending according to TKey.

Exceptions

source or action is a null reference (Nothing in Visual Basic).

One or more exceptions occurred during the evaluation of the query.

See also

Applies to

GroupBy<TSource,TKey,TElement>(ParallelQuery<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

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

Type Parameters

TSource

The type of elements of source.

TKey

The type of the key returned by keySelector.

TElement

The type of the elements in the IGrouping.

Parameters

source
ParallelQuery<TSource>

An OrderedParallelQuery{TSource}that contains elements to sort.

keySelector
Func<TSource,TKey>

A function to extract a key from an element.

elementSelector
Func<TSource,TElement>

A function to map each source element to an element in an IGrouping.

comparer
IEqualityComparer<TKey>

An IComparer{TSource} to compare keys.

Returns

ParallelQuery<IGrouping<TKey,TElement>>

A sequence of groups that are sorted descending according to TKey.

Exceptions

source or action is a null reference (Nothing in Visual Basic).

One or more exceptions occurred during the evaluation of the query.

See also

Applies to

GroupBy<TSource,TKey,TResult>(ParallelQuery<TSource>, Func<TSource,TKey>, Func<TKey,IEnumerable<TSource>,TResult>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

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)

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
ParallelQuery<TSource>

A sequence whose 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.

Returns

ParallelQuery<TResult>

A sequence of elements of type TResult where each element represents a projection over a group and its key.

Exceptions

source or action is a null reference (Nothing in Visual Basic).

One or more exceptions occurred during the evaluation of the query.

See also

Applies to

GroupBy<TSource,TKey,TResult>(ParallelQuery<TSource>, Func<TSource,TKey>, Func<TKey,IEnumerable<TSource>,TResult>, IEqualityComparer<TKey>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

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)

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
ParallelQuery<TSource>

A sequence whose 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

ParallelQuery<TResult>

A sequence of groups.

Exceptions

source or action is a null reference (Nothing in Visual Basic).

One or more exceptions occurred during the evaluation of the query.

See also

Applies to

GroupBy<TSource,TKey>(ParallelQuery<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

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

Type Parameters

TSource

The type of elements of source.

TKey

The type of the key returned by keySelector.

Parameters

source
ParallelQuery<TSource>

An OrderedParallelQuery<TSource> that contains elements to sort.

keySelector
Func<TSource,TKey>

A function to extract a key from an element.

comparer
IEqualityComparer<TKey>

An IComparer<T> to compare keys.

Returns

ParallelQuery<IGrouping<TKey,TSource>>

A sequence of groups that are sorted descending according to TKey.

Exceptions

source or action is a null reference (Nothing in Visual Basic).

One or more exceptions occurred during the evaluation of the query.

See also

Applies to

GroupBy<TSource,TKey>(ParallelQuery<TSource>, Func<TSource,TKey>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

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

Type Parameters

TSource

The type of elements of source.

TKey

The type of the key returned by keySelector.

Parameters

source
ParallelQuery<TSource>

An OrderedParallelQuery{TSource}that contains elements to sort.

keySelector
Func<TSource,TKey>

A function to extract a key from an element.

Returns

ParallelQuery<IGrouping<TKey,TSource>>

A sequence of groups that are sorted descending according to TKey.

Exceptions

source or action is a null reference (Nothing in Visual Basic).

One or more exceptions occurred during the evaluation of the query.

See also

Applies to