SortedDictionary<TKey,TValue>.Comparer 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
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) 操作。