TypedTableBaseExtensions.OrderBy<TRow, TKey> Method (TypedTableBase<TRow>, Func<TRow, TKey>, IComparer<TKey>)

 

Sorts the rows of a TypedTableBase<T> in ascending order according to the specified key and comparer.

Namespace:   System.Data
Assembly:  System.Data.DataSetExtensions (in System.Data.DataSetExtensions.dll)

public static OrderedEnumerableRowCollection<TRow> OrderBy<TRow, TKey>(
	this TypedTableBase<TRow> source,
	Func<TRow, TKey> keySelector,
	IComparer<TKey> comparer
)
where TRow : DataRow

Parameters

source
Type: System.Data.TypedTableBase<TRow>

A TypedTableBase<T> that contains the DataRow elements to be ordered.

keySelector
Type: System.Func<TRow, TKey>

A function to extract a key from an element.

comparer
Type: System.Collections.Generic.IComparer<TKey>

An IComparer<T> to compare keys.

Return Value

Type: System.Data.OrderedEnumerableRowCollection<TRow>

An OrderedEnumerableRowCollection<TRow> whose elements are sorted by the specified key and comparer.

Type Parameters

TRow

The type of the row elements in source, typically DataRow.

TKey

The type of the key returned by keySelector.

.NET Framework
Available since 3.5
Return to top
Show: