ImmutableArray<T>.Sort 方法

定义

重载

Sort()

使用默认比较器对不可变数组中的元素进行排序。Sorts the elements in the immutable array using the default comparer.

Sort(IComparer<T>)

使用指定的比较器对不可变数组中的元素进行排序。Sorts the elements in the immutable array using the specified comparer.

Sort(Comparison<T>)

使用指定的 Comparison<T>,对整个 ImmutableArray<T> 中的元素进行排序。Sorts the elements in the entire ImmutableArray<T> using the specified Comparison<T>.

Sort(Int32, Int32, IComparer<T>)

使用指定的比较器对不可变数组中的指定元素进行排序。Sorts the specified elements in the immutable array using the specified comparer.

Sort()

使用默认比较器对不可变数组中的元素进行排序。Sorts the elements in the immutable array using the default comparer.

public:
 System::Collections::Immutable::ImmutableArray<T> Sort();
public System.Collections.Immutable.ImmutableArray<T> Sort ();
member this.Sort : unit -> System.Collections.Immutable.ImmutableArray<'T>
Public Function Sort () As ImmutableArray(Of T)

返回

一个新的不可变数组,其中包含已排序的项。A new immutable array that contains the items in this array, in sorted order.

Sort(IComparer<T>)

使用指定的比较器对不可变数组中的元素进行排序。Sorts the elements in the immutable array using the specified comparer.

public:
 System::Collections::Immutable::ImmutableArray<T> Sort(System::Collections::Generic::IComparer<T> ^ comparer);
public System.Collections.Immutable.ImmutableArray<T> Sort (System.Collections.Generic.IComparer<T> comparer);
member this.Sort : System.Collections.Generic.IComparer<'T> -> System.Collections.Immutable.ImmutableArray<'T>
Public Function Sort (comparer As IComparer(Of T)) As ImmutableArray(Of T)

参数

comparer
IComparer<T>

比较元素时要使用的实现,若要使用默认比较器,则为 nullThe implementation to use when comparing elements, or null to use the default comparer

返回

一个新的不可变数组,其中包含已排序的项。A new immutable array that contains the items in this array, in sorted order.

Sort(Comparison<T>)

使用指定的 Comparison<T>,对整个 ImmutableArray<T> 中的元素进行排序。Sorts the elements in the entire ImmutableArray<T> using the specified Comparison<T>.

public:
 System::Collections::Immutable::ImmutableArray<T> Sort(Comparison<T> ^ comparison);
public System.Collections.Immutable.ImmutableArray<T> Sort (Comparison<T> comparison);
member this.Sort : Comparison<'T> -> System.Collections.Immutable.ImmutableArray<'T>
Public Function Sort (comparison As Comparison(Of T)) As ImmutableArray(Of T)

参数

comparison
Comparison<T>

比较元素时要使用的 Comparison<T>The Comparison<T> to use when comparing elements.

返回

已排序的列表。The sorted list.

异常

comparison 为 null。comparison is null.

Sort(Int32, Int32, IComparer<T>)

使用指定的比较器对不可变数组中的指定元素进行排序。Sorts the specified elements in the immutable array using the specified comparer.

public:
 System::Collections::Immutable::ImmutableArray<T> Sort(int index, int count, System::Collections::Generic::IComparer<T> ^ comparer);
public System.Collections.Immutable.ImmutableArray<T> Sort (int index, int count, System.Collections.Generic.IComparer<T> comparer);
member this.Sort : int * int * System.Collections.Generic.IComparer<'T> -> System.Collections.Immutable.ImmutableArray<'T>
Public Function Sort (index As Integer, count As Integer, comparer As IComparer(Of T)) As ImmutableArray(Of T)

参数

index
Int32

要排序的第一个元素的索引。The index of the first element to sort.

count
Int32

要包括在排序中的元素数。The number of elements to include in the sort.

comparer
IComparer<T>

比较元素时要使用的实现,若要使用默认比较器,则为 nullThe implementation to use when comparing elements, or null to use the default comparer

返回

一个新的不可变数组,其中包含已排序的项。A new immutable array that contains the items in this array, in sorted order.

适用于