| ListExtensionsOrderByTElement, TKey Method |
Sorts the elements of a sequence in ascending or descending order according to a key.
Namespace:
Ookii.Jumbo
Assembly:
Ookii.Jumbo (in Ookii.Jumbo.dll) Version: 2.0.0
Syntax public static IOrderedEnumerable<TElement> OrderBy<TElement, TKey>(
this IEnumerable<TElement> source,
Func<TElement, TKey> keySelector,
bool ascending
)
<ExtensionAttribute>
Public Shared Function OrderBy(Of TElement, TKey) (
source As IEnumerable(Of TElement),
keySelector As Func(Of TElement, TKey),
ascending As Boolean
) As IOrderedEnumerable(Of TElement)
public:
[ExtensionAttribute]
generic<typename TElement, typename TKey>
static IOrderedEnumerable<TElement>^ OrderBy(
IEnumerable<TElement>^ source,
Func<TElement, TKey>^ keySelector,
bool ascending
)
[<ExtensionAttribute>]
static member OrderBy :
source : IEnumerable<'TElement> *
keySelector : Func<'TElement, 'TKey> *
ascending : bool -> IOrderedEnumerable<'TElement>
Parameters
- source
- Type: System.Collections.GenericIEnumerableTElement
A sequence of values to order. - keySelector
- Type: SystemFuncTElement, TKey
A function to extract a key from an element. - ascending
- Type: SystemBoolean
to sort in ascending order; to sort in descending order.
Type Parameters
- TElement
- The type of the element of source.
- TKey
- The type of the key returned by keySelector.
Return Value
Type:
IOrderedEnumerableTElementAn
IOrderedEnumerableTElement 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
IEnumerableTElement. 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).
See Also