TEnumerable.OrderBy<T,TKey> Method
Overloads
| OrderBy<T,TKey>(IEnumerable<T>, Func<T,TKey>) |
Sorts the elements of a sequence in ascending order according to a key. |
| OrderBy<T,TKey>(IEnumerable<T>, Func<T,TKey>, IComparer<TKey>) |
Sorts the elements of a sequence in ascending order by using a specified comparer. |
Sorts the elements of a sequence in ascending order according to a key.
class function OrderBy<T,TKey>(const source: IEnumerable<T>; const keySelector: Func<T, TKey>): IEnumerable<T>
Type Parameters
- T
The type of the elements of source .
- TKey
The type of the key returned by keySelector .
Parameters
- source
- IEnumerable<T>
A sequence of values to order.
- keySelector
- Func<T, TKey>
A function to extract a key from an element.
Returns
A sequence whose elements are sorted according to a key.
Sorts the elements of a sequence in ascending order by using a specified comparer.
class function OrderBy<T,TKey>(const source: IEnumerable<T>; const keySelector: Func<T, TKey>; const comparer: IComparer<TKey>): IEnumerable<T>
Type Parameters
- T
The type of the elements of source .
- TKey
The type of the key returned by keySelector .
Parameters
- source
- IEnumerable<T>
A sequence of values to order.
- keySelector
- Func<T, TKey>
A function to extract a key from an element.
- comparer
- IComparer<TKey>
A comparer to compare keys.
Returns
A sequence whose elements are sorted according to a key.
Exceptions
source or keySelector or comparer is nil .