MemoryExtensions.Sort Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Sort<T,TComparer>(Span<T>, TComparer) |
Sorts the elements in the entire Span<T> using the |
Sort<T>(Span<T>, Comparison<T>) |
Sorts the elements in the entire Span<T> using the specified Comparison<T>. |
Sort<T>(Span<T>) |
Sorts the elements in the entire Span<T> using the IComparable<T> implementation of each element of the Span<T>. |
Sort<TKey,TValue,TComparer>(Span<TKey>, Span<TValue>, TComparer) |
Sorts a pair of spans (one containing the keys and the other containing the corresponding items) based on the keys in the first Span<T> using the specified comparer. |
Sort<TKey,TValue>(Span<TKey>, Span<TValue>) |
Sorts a pair of spans (one containing the keys and the other containing the corresponding items) based on the keys in the first Span<T> using the IComparable<T> implementation of each key. |
Sort<TKey,TValue>(Span<TKey>, Span<TValue>, Comparison<TKey>) |
Sorts a pair of spans (one containing the keys and the other containing the corresponding items) based on the keys in the first Span<T> using the specified comparison. |
Sort<T,TComparer>(Span<T>, TComparer)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Sorts the elements in the entire Span<T> using the TComparer
.
public:
generic <typename T, typename TComparer>
where TComparer : System::Collections::Generic::IComparer<T>[System::Runtime::CompilerServices::Extension]
static void Sort(Span<T> span, TComparer comparer);
public static void Sort<T,TComparer> (this Span<T> span, TComparer comparer) where TComparer : System.Collections.Generic.IComparer<T>;
static member Sort : Span<'T> * 'Comparer -> unit (requires 'Comparer :> System.Collections.Generic.IComparer<'T>)
<Extension()>
Public Sub Sort(Of T, TComparer) (span As Span(Of T), comparer As TComparer)
Type Parameters
- T
The type of the elements of the span.
- TComparer
The type of the comparer to use to compare elements.
Parameters
- span
- Span<T>
The span of memory to sort.
- comparer
- TComparer
The method to use when comparing elements, or null
to use each element's IComparable<T> interface implementation.
Exceptions
comparer
is null
, and one or more elements in span
do not implement the IComparable<T> interface.
The implementation of comparer
caused an error during the sort.
Applies to
Sort<T>(Span<T>, Comparison<T>)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Sorts the elements in the entire Span<T> using the specified Comparison<T>.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static void Sort(Span<T> span, Comparison<T> ^ comparison);
public static void Sort<T> (this Span<T> span, Comparison<T> comparison);
static member Sort : Span<'T> * Comparison<'T> -> unit
<Extension()>
Public Sub Sort(Of T) (span As Span(Of T), comparison As Comparison(Of T))
Type Parameters
- T
The type of the elements of the span.
Parameters
- span
- Span<T>
The span of memory to sort.
- comparison
- Comparison<T>
The method to use when comparing elements.
Exceptions
comparison
is null
.
Applies to
Sort<T>(Span<T>)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Sorts the elements in the entire Span<T> using the IComparable<T> implementation of each element of the Span<T>.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static void Sort(Span<T> span);
public static void Sort<T> (this Span<T> span);
static member Sort : Span<'T> -> unit
<Extension()>
Public Sub Sort(Of T) (span As Span(Of T))
Type Parameters
- T
The type of the elements of the span.
Parameters
- span
- Span<T>
The span of memory to sort.
Exceptions
One or more elements in span
do not implement the IComparable<T> interface.
Applies to
Sort<TKey,TValue,TComparer>(Span<TKey>, Span<TValue>, TComparer)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Sorts a pair of spans (one containing the keys and the other containing the corresponding items) based on the keys in the first Span<T> using the specified comparer.
public:
generic <typename TKey, typename TValue, typename TComparer>
where TComparer : System::Collections::Generic::IComparer<TKey>[System::Runtime::CompilerServices::Extension]
static void Sort(Span<TKey> keys, Span<TValue> items, TComparer comparer);
public static void Sort<TKey,TValue,TComparer> (this Span<TKey> keys, Span<TValue> items, TComparer comparer) where TComparer : System.Collections.Generic.IComparer<TKey>;
static member Sort : Span<'Key> * Span<'Value> * 'Comparer -> unit (requires 'Comparer :> System.Collections.Generic.IComparer<'Key>)
<Extension()>
Public Sub Sort(Of TKey, TValue, TComparer) (keys As Span(Of TKey), items As Span(Of TValue), comparer As TComparer)
Type Parameters
- TKey
The type of the elements of the key span.
- TValue
The type of the elements of the items span.
- TComparer
The type of the comparer to use to compare elements.
Parameters
- keys
- Span<TKey>
The span that contains the keys to sort.
- items
- Span<TValue>
The span that contains the items that correspond to the keys in keys
.
- comparer
- TComparer
The IComparer<T> implementation to use when comparing elements, or null
to use the IComparable<T> interface implementation of each element.
Exceptions
The length of keys
isn't equal to the length of items
.
comparer
is null
, and one or more elements in keys
do not implement the IComparable<T> interface.
Applies to
Sort<TKey,TValue>(Span<TKey>, Span<TValue>)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Sorts a pair of spans (one containing the keys and the other containing the corresponding items) based on the keys in the first Span<T> using the IComparable<T> implementation of each key.
public:
generic <typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
static void Sort(Span<TKey> keys, Span<TValue> items);
public static void Sort<TKey,TValue> (this Span<TKey> keys, Span<TValue> items);
static member Sort : Span<'Key> * Span<'Value> -> unit
<Extension()>
Public Sub Sort(Of TKey, TValue) (keys As Span(Of TKey), items As Span(Of TValue))
Type Parameters
- TKey
The type of the elements of the key span.
- TValue
The type of the elements of the items span.
Parameters
- keys
- Span<TKey>
The span that contains the keys to sort.
- items
- Span<TValue>
The span that contains the items that correspond to the keys in keys
.
Exceptions
The length of keys
isn't equal to the length of items
.
One or more elements in keys
do not implement the IComparable<T> interface.
Applies to
Sort<TKey,TValue>(Span<TKey>, Span<TValue>, Comparison<TKey>)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Sorts a pair of spans (one containing the keys and the other containing the corresponding items) based on the keys in the first Span<T> using the specified comparison.
public:
generic <typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
static void Sort(Span<TKey> keys, Span<TValue> items, Comparison<TKey> ^ comparison);
public static void Sort<TKey,TValue> (this Span<TKey> keys, Span<TValue> items, Comparison<TKey> comparison);
static member Sort : Span<'Key> * Span<'Value> * Comparison<'Key> -> unit
<Extension()>
Public Sub Sort(Of TKey, TValue) (keys As Span(Of TKey), items As Span(Of TValue), comparison As Comparison(Of TKey))
Type Parameters
- TKey
The type of the elements of the key span.
- TValue
The type of the elements of the items span.
Parameters
- keys
- Span<TKey>
The span that contains the keys to sort.
- items
- Span<TValue>
The span that contains the items that correspond to the keys in keys
.
- comparison
- Comparison<TKey>
The Comparison<T> to use when comparing elements.
Exceptions
comparison
is null
.
The length of keys
isn't equal to the length of items
.
Applies to
Feedback
https://aka.ms/ContentUserFeedback.
Binnenkort beschikbaar: In de loop van 2024 zullen we GitHub-problemen geleidelijk uitfaseren als het feedbackmechanisme voor inhoud en deze vervangen door een nieuw feedbacksysteem. Zie voor meer informatie:Feedback verzenden en weergeven voor