EnumerableRowCollectionExtensions.ThenByDescending Method
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.
Performs a secondary ordering of the rows of a EnumerableRowCollection in descending order.
ThenByDescending<TRow,TKey>(OrderedEnumerableRowCollection<TRow>, Func<TRow,TKey>) |
This API supports the product infrastructure and is not intended to be used directly from your code. Performs a secondary ordering of the rows of a EnumerableRowCollection in descending order according to the specified key. |
ThenByDescending<TRow,TKey>(OrderedEnumerableRowCollection<TRow>, Func<TRow,TKey>, IComparer<TKey>) |
This API supports the product infrastructure and is not intended to be used directly from your code. Performs a secondary ordering of the rows of a EnumerableRowCollection in descending order according to the specified key and comparer. |
Performs a secondary ordering of the rows of a EnumerableRowCollection in descending order according to the specified key.
This API supports the product infrastructure and is not intended to be used directly from your code.
public:
generic <typename TRow, typename TKey>
[System::Runtime::CompilerServices::Extension]
static System::Data::OrderedEnumerableRowCollection<TRow> ^ ThenByDescending(System::Data::OrderedEnumerableRowCollection<TRow> ^ source, Func<TRow, TKey> ^ keySelector);
public static System.Data.OrderedEnumerableRowCollection<TRow> ThenByDescending<TRow,TKey> (this System.Data.OrderedEnumerableRowCollection<TRow> source, Func<TRow,TKey> keySelector);
static member ThenByDescending : System.Data.OrderedEnumerableRowCollection<'Row> * Func<'Row, 'Key> -> System.Data.OrderedEnumerableRowCollection<'Row>
<Extension()>
Public Function ThenByDescending(Of TRow, TKey) (source As OrderedEnumerableRowCollection(Of TRow), keySelector As Func(Of TRow, TKey)) As OrderedEnumerableRowCollection(Of TRow)
Type Parameters
- TRow
The type of the row elements in source
, typically DataRow.
- TKey
The type of the key returned by keySelector
.
Parameters
An EnumerableRowCollection containing the DataRow elements to be ordered.
- keySelector
- Func<TRow,TKey>
A function to extract a key from an element.
Returns
An OrderedEnumerableRowCollection<TRow> whose elements are sorted by the specified key.
Remarks
The use of a ThenByDescending operation requires an existing primary sorting operation using OrderBy.
This method is implemented by using deferred execution. The immediate return value is an object that stores all the information that is required to perform the action. The query represented by this method is not executed until the object is enumerated either by calling its GetEnumerator
method directly or by using foreach
in Visual C# or For Each
in Visual Basic.
See also
- Select<TRow,S>(EnumerableRowCollection<TRow>, Func<TRow,S>)
- OrderByDescending
- ThenByDescending<TSource,TKey>(IOrderedEnumerable<TSource>, Func<TSource,TKey>)
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 3.5, 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 (package-provided), 2.1 |
Performs a secondary ordering of the rows of a EnumerableRowCollection in descending order according to the specified key and comparer.
This API supports the product infrastructure and is not intended to be used directly from your code.
public:
generic <typename TRow, typename TKey>
[System::Runtime::CompilerServices::Extension]
static System::Data::OrderedEnumerableRowCollection<TRow> ^ ThenByDescending(System::Data::OrderedEnumerableRowCollection<TRow> ^ source, Func<TRow, TKey> ^ keySelector, System::Collections::Generic::IComparer<TKey> ^ comparer);
public static System.Data.OrderedEnumerableRowCollection<TRow> ThenByDescending<TRow,TKey> (this System.Data.OrderedEnumerableRowCollection<TRow> source, Func<TRow,TKey> keySelector, System.Collections.Generic.IComparer<TKey> comparer);
static member ThenByDescending : System.Data.OrderedEnumerableRowCollection<'Row> * Func<'Row, 'Key> * System.Collections.Generic.IComparer<'Key> -> System.Data.OrderedEnumerableRowCollection<'Row>
<Extension()>
Public Function ThenByDescending(Of TRow, TKey) (source As OrderedEnumerableRowCollection(Of TRow), keySelector As Func(Of TRow, TKey), comparer As IComparer(Of TKey)) As OrderedEnumerableRowCollection(Of TRow)
Type Parameters
- TRow
The type of the row elements in source
, typically DataRow.
- TKey
The type of the key returned by keySelector
.
Parameters
An EnumerableRowCollection containing the DataRow elements to be ordered.
- keySelector
- Func<TRow,TKey>
A function to extract a key from an element.
- comparer
- IComparer<TKey>
An IComparer<T> to compare keys.
Returns
An OrderedEnumerableRowCollection<TRow> whose elements are sorted by the specified key and comparer.
Remarks
The use of a ThenByDescending operation requires an existing primary sorting operation using OrderBy.
This method is implemented by using deferred execution. The immediate return value is an object that stores all the information that is required to perform the action. The query represented by this method is not executed until the object is enumerated either by calling its GetEnumerator
method directly or by using foreach
in Visual C# or For Each
in Visual Basic.
See also
- Select<TRow,S>(EnumerableRowCollection<TRow>, Func<TRow,S>)
- OrderByDescending
- ThenByDescending<TSource,TKey>(IOrderedEnumerable<TSource>, Func<TSource,TKey>, IComparer<TKey>)
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 3.5, 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 (package-provided), 2.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: