IOrderedEnumerable<TElement>::CreateOrderedEnumerable<TKey> Method (Func<TElement, TKey>^, IComparer<TKey>^, Boolean)
Performs a subsequent ordering on the elements of an IOrderedEnumerable<TElement> according to a key.
Assembly: System.Core (in System.Core.dll)
generic<typename TKey> IOrderedEnumerable<TElement>^ CreateOrderedEnumerable( Func<TElement, TKey>^ keySelector, IComparer<TKey>^ comparer, bool descending )
Parameters
- keySelector
-
Type:
System::Func<TElement, TKey>^
The Func<T, TResult> used to extract the key for each element.
- comparer
-
Type:
System.Collections.Generic::IComparer<TKey>^
The IComparer<T> used to compare keys for placement in the returned sequence.
- descending
-
Type:
System::Boolean
true to sort the elements in descending order; false to sort the elements in ascending order.
Return Value
Type: System.Linq::IOrderedEnumerable<TElement>^An IOrderedEnumerable<TElement> whose elements are sorted according to a key.
Type Parameters
- TKey
The type of the key produced by keySelector.
The functionality provided by this method is like that provided by ThenBy or ThenByDescending, depending on whether descending is true or false. They both perform a subordinate ordering of an already sorted sequence of type IOrderedEnumerable<TElement>.
The following code example demonstrates how to use CreateOrderedEnumerable<TKey> to perform a secondary ordering on an IOrderedEnumerable<TElement>.
Available since 8
.NET Framework
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1