SortedDictionary<TKey,TValue>.Comparer 属性

定义

IComparer<T>获取用于对 . 的元素进行排序的SortedDictionary<TKey,TValue>

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> 需要比较器实现才能执行关键比较。 可以使用接受comparer参数的IComparer<T>构造函数指定泛型接口的实现。 如果不这样做,将使用默认泛型相等比较器 Comparer<T>.Default。 如果类型 TKey 实现 System.IComparable<T> 泛型接口,则默认比较器使用该实现。

获取此属性的值是 O(1) 操作。

适用于

另请参阅