Export (0) Print
Expand All

ParallelEnumerable.ThenBy(Of TSource, TKey) Method (OrderedParallelQuery(Of TSource), Func(Of TSource, TKey))

Performs in parallel a subsequent ordering of the elements in a sequence in ascending order according to a key.

Namespace:  System.Linq
Assembly:  System.Core (in System.Core.dll)

<ExtensionAttribute> _
Public Shared Function ThenBy(Of TSource, TKey) ( _
	source As OrderedParallelQuery(Of TSource), _
	keySelector As Func(Of TSource, TKey) _
) As OrderedParallelQuery(Of TSource)

Type Parameters


The type of elements of source.


The type of the key returned by keySelector.


Type: System.Linq.OrderedParallelQuery(Of TSource)

An OrderedParallelQuery{TSource} that contains elements to sort.

Type: System.Func(Of TSource, TKey)

A function to extract a key from an element.

Return Value

Type: System.Linq.OrderedParallelQuery(Of TSource)
An OrderedParallelQuery{TSource} whose elements are sorted according to a key.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type OrderedParallelQuery(Of TSource). When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).


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


The query was canceled with the token passed in through WithCancellation.


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

In contrast to the sequential implementation, this is not a stable sort. See the remarks for OrderBy for an approach to implementing a stable sort.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1
© 2015 Microsoft