ImmutableList<T>.Sort Method

Definition

Overloads

Sort()

Sorts the elements in the entire immutable list using the default comparer.

Sort(IComparer<T>)

Sorts the elements in the entire immutable list using the specified comparer.

Sort(Comparison<T>)

Sorts the elements in the entire immutable list using the specified comparer.

Sort(Int32, Int32, IComparer<T>)

Sorts a range of elements in the immutable list using the specified comparer.

Sort()

Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs

Sorts the elements in the entire immutable list using the default comparer.

C#
public System.Collections.Immutable.ImmutableList<T> Sort();

Returns

The sorted list.

Applies to

.NET 10 och andra versioner
Produkt Versioner
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0

Sort(IComparer<T>)

Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs

Sorts the elements in the entire immutable list using the specified comparer.

C#
public System.Collections.Immutable.ImmutableList<T> Sort(System.Collections.Generic.IComparer<T> comparer);
C#
public System.Collections.Immutable.ImmutableList<T> Sort(System.Collections.Generic.IComparer<T>? comparer);

Parameters

comparer
IComparer<T>

The implementation to use when comparing elements, or null to use the default comparer (Default).

Returns

The sorted list.

Applies to

.NET 10 och andra versioner
Produkt Versioner
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0

Sort(Comparison<T>)

Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs

Sorts the elements in the entire immutable list using the specified comparer.

C#
public System.Collections.Immutable.ImmutableList<T> Sort(Comparison<T> comparison);

Parameters

comparison
Comparison<T>

The delegate to use when comparing elements.

Returns

The sorted list.

Exceptions

comparison is null.

Applies to

.NET 10 och andra versioner
Produkt Versioner
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0

Sort(Int32, Int32, IComparer<T>)

Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs

Sorts a range of elements in the immutable list using the specified comparer.

C#
public System.Collections.Immutable.ImmutableList<T> Sort(int index, int count, System.Collections.Generic.IComparer<T> comparer);
C#
public System.Collections.Immutable.ImmutableList<T> Sort(int index, int count, System.Collections.Generic.IComparer<T>? comparer);

Parameters

index
Int32

The zero-based starting index of the range to sort.

count
Int32

The length of the range to sort.

comparer
IComparer<T>

The implementation to use when comparing elements, or null to use the default comparer (Default).

Returns

The sorted list.

Applies to

.NET 10 och andra versioner
Produkt Versioner
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0