Enumerable.Order Method (System.Linq) (original) (raw)

Source:

OrderBy.cs

Source:

OrderBy.cs

Source:

OrderBy.cs

Sorts the elements of a sequence in ascending order.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::IOrderedEnumerable<T> ^ Order(System::Collections::Generic::IEnumerable<T> ^ source, System::Collections::Generic::IComparer<T> ^ comparer);
public static System.Linq.IOrderedEnumerable<T> Order<T>(this System.Collections.Generic.IEnumerable<T> source, System.Collections.Generic.IComparer<T>? comparer);
static member Order : seq<'T> * System.Collections.Generic.IComparer<'T> -> System.Linq.IOrderedEnumerable<'T>
<Extension()>
Public Function Order(Of T) (source As IEnumerable(Of T), comparer As IComparer(Of T)) As IOrderedEnumerable(Of T)

Type Parameters

T

The type of the elements of source.

Parameters

Returns

An IOrderedEnumerable whose elements are sorted.

Exceptions

Remarks

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 by calling its <see cref="M:System.Collections.Generic.IEnumerable`1.GetEnumerator> method.

If comparer is null, the default comparer <see cref="P:System.Collections.Generic.Comparer`1.Default> is used to compare elements.

See also

Applies to