Method Sort
Sort<T>(ExSpan<T>)
Sorts the elements in the entire ExSpan<T> using the IComparable<T> implementation of each element of the ExSpan<T>
public static void Sort<T>(this ExSpan<T> span)
Parameters
Type Parameters
T
The type of the elements of the span.
Exceptions
- InvalidOperationException
One or more elements in
span
do not implement the IComparable<T> interface.
Sort<T, TComparer>(ExSpan<T>, TComparer)
Sorts the elements in the entire ExSpan<T> using the TComparer
.
public static void Sort<T, TComparer>(this ExSpan<T> span, TComparer comparer) where TComparer : IComparer<T>?
Parameters
span
ExSpan<T>The ExSpan<T> to sort.
comparer
TComparerThe IComparer<T> implementation to use when comparing elements, or null to use the IComparable<T> interface implementation of each element.
Type Parameters
T
The type of the elements of the span.
TComparer
The type of the comparer to use to compare elements.
Exceptions
- InvalidOperationException
comparer
is null, and one or more elements inspan
do not implement the IComparable<T> interface.- ArgumentException
The implementation of
comparer
caused an error during the sort.
Sort<T>(ExSpan<T>, Comparison<T>)
Sorts the elements in the entire ExSpan<T> using the specified Comparison<T>.
public static void Sort<T>(this ExSpan<T> span, Comparison<T> comparison)
Parameters
span
ExSpan<T>The ExSpan<T> to sort.
comparison
Comparison<T>The Comparison<T> to use when comparing elements.
Type Parameters
T
The type of the elements of the span.
Exceptions
- ArgumentNullException
comparison
is null.
Sort<TKey, TValue>(ExSpan<TKey>, ExSpan<TValue>)
Sorts a pair of ExSpans (one containing the keys and the other containing the corresponding items) based on the keys in the first ExSpan<T> using the IComparable<T> implementation of each key.
public static void Sort<TKey, TValue>(this ExSpan<TKey> keys, ExSpan<TValue> items)
Parameters
keys
ExSpan<TKey>The span that contains the keys to sort.
items
ExSpan<TValue>The span that contains the items that correspond to the keys in
keys
.
Type Parameters
TKey
The type of the elements of the key span.
TValue
The type of the elements of the items span.
Exceptions
- ArgumentException
The length of
keys
isn't equal to the length ofitems
.- InvalidOperationException
One or more elements in
keys
do not implement the IComparable<T> interface.
Sort<TKey, TValue, TComparer>(ExSpan<TKey>, ExSpan<TValue>, TComparer)
Sorts a pair of ExSpans (one containing the keys and the other containing the corresponding items) based on the keys in the first ExSpan<T> using the specified comparer.
public static void Sort<TKey, TValue, TComparer>(this ExSpan<TKey> keys, ExSpan<TValue> items, TComparer comparer) where TComparer : IComparer<TKey>?
Parameters
keys
ExSpan<TKey>The span that contains the keys to sort.
items
ExSpan<TValue>The span that contains the items that correspond to the keys in
keys
.comparer
TComparerThe IComparer<T> implementation to use when comparing elements, or null to use the IComparable<T> interface implementation of each element.
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.
Exceptions
- ArgumentException
The length of
keys
isn't equal to the length ofitems
.- InvalidOperationException
comparer
is null, and one or more elements inkeys
do not implement the IComparable<T> interface.
Sort<TKey, TValue>(ExSpan<TKey>, ExSpan<TValue>, Comparison<TKey>)
Sorts a pair of ExSpans (one containing the keys and the other containing the corresponding items) based on the keys in the first ExSpan<T> using the specified comparison.
public static void Sort<TKey, TValue>(this ExSpan<TKey> keys, ExSpan<TValue> items, Comparison<TKey> comparison)
Parameters
keys
ExSpan<TKey>The span that contains the keys to sort.
items
ExSpan<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.
Type Parameters
TKey
The type of the elements of the key span.
TValue
The type of the elements of the items span.
Exceptions
- ArgumentNullException
comparison
is null.- ArgumentException
The length of
keys
isn't equal to the length ofitems
.