語言

SortedDictionary<TKey,TValue>.Comparer 屬性

定義

public:
 property System::Collections::Generic::IComparer<TKey> ^ Comparer { System::Collections::Generic::IComparer<TKey> ^ get(); };
public System.Collections.Generic.IComparer<TKey> Comparer { get; }
member this.Comparer : System.Collections.Generic.IComparer<'Key>
Public ReadOnly Property Comparer As IComparer(Of TKey)

屬性值

IComparer<TKey>

用來 IComparer<T> 排序 的元素 SortedDictionary<TKey,TValue>

備註

SortedDictionary<TKey,TValue> 需要比較器實作來執行金鑰比較。 你可以使用接受IComparer<T>參數的建構子來指定通用介面的實作comparer。 若不使用,則使用預設的通用等號比較器 Comparer<T>.Default。 若型別 TKey 實 System.IComparable<T> 作通用介面,預設比較器則使用該實作。

取得此性質的值需進行 O(1) 運算。

適用於

另請參閱