SortedDictionary

发布日期:2019-11-28 作者:mi52.com 人气:

SortedDictionary<TKey,TValue>

表示类根据键进行排序的键/值对的集合

命名空间:                   System.Collections.Generic

程序集:         System(位于 System.dll)


类型参数

TKey   字典中的键的类型。

TValue   字典中的值的类型。


构造函数

SortedDictionary<TKey,TValue>()

初始化 SortedDictionary<TKey,TValue> 类的一个新实例,该实例为空并对键类型使用默认 IComparer<T> 实现。


SortedDictionary<TKey,TValue>(IComparer<TKey>)

初始化 SortedDictionary<TKey,TValue> 类的一个新实例,该实例为空并对比较键使用指定 IComparer<T> 实现。


SortedDictionary<TKey,TValue>(IDictionary<TKey,TValue>)

初始化 SortedDictionary<TKey,TValue> 类的新实例,该实例包含从指定的 IDictionary<TKey,TValue> 中复制的元素,并使用键类型的默认 IComparer<T> 实现。


SortedDictionary<TKey,TValue>(IDictionary<TKey,TValue>,IComparer<TKey>)

初始化 SortedDictionary<TKey,TValue> 类的新实例,该实例包含从指定的 IDictionary<TKey,TValue> 中复制的元素,并使用指定的 IComparer<T> 实现来比较键。




属性

Comparer

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


Count

获取包含在 SortedDictionary<TKey,TValue> 中的键/值对的数目。


Item[TKey]

获取或设置与指定的键关联的值。


Keys

获得一个包含 SortedDictionary<TKey,TValue> 中的键的集合。


Values

获得一个包含 SortedDictionary<TKey,TValue> 中的值的集合。




方法

Add(TKey,TValue)

将带有指定键和值的元素添加到 SortedDictionary<TKey,TValue> 中。


Clear()

从 SortedDictionary<TKey,TValue> 中移除所有元素。


ContainsKey(TKey)

确定是否 SortedDictionary<TKey,TValue> 包含带有指定键的元素。


ContainsValue(TValue)

确定 SortedDictionary<TKey,TValue> 是否包含具有指定值的元素。


CopyTo(KeyValuePair<TKey,TValue>[],Int32)

从指定的索引处开始,将 SortedDictionary<TKey,TValue> 的元素复制到指定的 KeyValuePair<TKey,TValue> 结构的数组中。


Equals(Object)

确定指定的对象是否等于当前对象。(继承自 Object。)


Finalize()

在垃圾回收将某一对象回收前允许该对象尝试释放资源并执行其他清理操作。(继承自 Object。)


GetEnumerator()

返回循环访问 SortedDictionary<TKey,TValue> 的枚举数。


GetHashCode()

作为默认哈希函数。(继承自 Object。)


GetType()

获取当前实例的 Type。(继承自 Object。)


MemberwiseClone()

创建当前 Object 的浅表副本。(继承自 Object。)


Remove(TKey)

从 SortedDictionary<TKey,TValue> 中移除带有指定键的元素。


ToString()

返回表示当前对象的字符串。(继承自 Object。)


TryGetValue(TKey,TValue)

获取与指定键关联的值。



来源:https://blog.51cto.com/jiaojusuimu/1884710


返回顶部

拨打电话
首页