MemoryExtensions.Sort 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
Sort<T,TComparer>(Span<T>, TComparer) |
使用 |
Sort<T>(Span<T>) |
使用 IComparable<T> 的每個 專案實作,排序整個 Span<T> 中的 Span<T> 專案。 |
Sort<T>(Span<T>, Comparison<T>) |
使用指定的 Comparison<T> 來排序在整個 Span<T> 中的項目。 |
Sort<TKey,TValue,TComparer>(Span<TKey>, Span<TValue>, TComparer) |
使用指定的比較子,根據第一個 Span<T> 中的索引鍵來排序一對範圍 (其中一個範圍包含索引鍵,另一個範圍包含對應的項目)。 |
Sort<TKey,TValue>(Span<TKey>, Span<TValue>) |
使用每個索引鍵的 IComparable<T> 實作,根據第一個 Span<T> 中的索引鍵,排序一對範圍 (其中一個範圍包含索引鍵,另一個範圍包含對應的項目)。 |
Sort<TKey,TValue>(Span<TKey>, Span<TValue>, Comparison<TKey>) |
使用指定的比較,根據第一個 Span<T> 中的索引鍵來排序一對範圍 (其中一個範圍包含索引鍵,另一個範圍包含對應的項目)。 |
Sort<T,TComparer>(Span<T>, TComparer)
使用 TComparer
來排序整個 Span<T> 中的項目。
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)
類型參數
- T
範圍專案的型別。
- TComparer
要用來比較專案之比較子的類型。
參數
- span
- Span<T>
要排序的記憶體範圍。
- comparer
- TComparer
比較項目時所使用的方法,或使用每個項目其 IComparable<T> 介面實作時的 null
。
例外狀況
comparer
為 null
,而且 span
中的一或多個項目沒有實作 IComparable<T> 介面。
comparer
的實作在排序期間造成錯誤。
適用於
Sort<T>(Span<T>)
使用 IComparable<T> 的每個 專案實作,排序整個 Span<T> 中的 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))
類型參數
- T
範圍專案的型別。
參數
- span
- Span<T>
要排序的記憶體範圍。
例外狀況
span
中的一或多個項目未實作 IComparable<T> 介面。
適用於
Sort<T>(Span<T>, Comparison<T>)
使用指定的 Comparison<T> 來排序在整個 Span<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))
類型參數
- T
範圍專案的型別。
參數
- span
- Span<T>
要排序的記憶體範圍。
- comparison
- Comparison<T>
比較項目時所使用的方法。
例外狀況
comparison
為 null
。
適用於
Sort<TKey,TValue,TComparer>(Span<TKey>, Span<TValue>, TComparer)
使用指定的比較子,根據第一個 Span<T> 中的索引鍵來排序一對範圍 (其中一個範圍包含索引鍵,另一個範圍包含對應的項目)。
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)
類型參數
- TKey
索引鍵範圍的元素類型。
- TValue
專案範圍的專案類型。
- TComparer
要用來比較專案之比較子的類型。
參數
- keys
- Span<TKey>
包含所要排序索引鍵的範圍。
- items
- Span<TValue>
包含對應至 keys
中索引鍵項目的範圍。
- comparer
- TComparer
在比較項目時所使用的 IComparer<T> 實作,或使用每個項目 IComparable<T> 介面實作時的 null
。
例外狀況
keys
其長度不等於 items
的長度。
comparer
為 null
,而且 keys
中的一或多個項目沒有實作 IComparable<T> 介面。
適用於
Sort<TKey,TValue>(Span<TKey>, Span<TValue>)
使用每個索引鍵的 IComparable<T> 實作,根據第一個 Span<T> 中的索引鍵,排序一對範圍 (其中一個範圍包含索引鍵,另一個範圍包含對應的項目)。
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))
類型參數
- TKey
索引鍵範圍的元素類型。
- TValue
專案範圍的專案類型。
參數
- keys
- Span<TKey>
包含所要排序索引鍵的範圍。
- items
- Span<TValue>
包含對應至 keys
中索引鍵項目的範圍。
例外狀況
keys
其長度不等於 items
的長度。
keys
中的一或多個項目未實作 IComparable<T> 介面。
適用於
Sort<TKey,TValue>(Span<TKey>, Span<TValue>, Comparison<TKey>)
使用指定的比較,根據第一個 Span<T> 中的索引鍵來排序一對範圍 (其中一個範圍包含索引鍵,另一個範圍包含對應的項目)。
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))
類型參數
- TKey
索引鍵範圍的元素類型。
- TValue
專案範圍的專案類型。
參數
- keys
- Span<TKey>
包含所要排序索引鍵的範圍。
- items
- Span<TValue>
包含對應至 keys
中索引鍵項目的範圍。
- comparison
- Comparison<TKey>
比較項目時所要使用的 Comparison<T>。
例外狀況
comparison
為 null
。
keys
其長度不等於 items
的長度。