- SortedList类常用的属性
属性 | 描述 |
---|---|
Capacity | 获取或设置SortedList的容量 |
Count | 获取SortedList中的元素个数 |
IsFixedSize | 获取一个值,表示SortedList是否具有固定大小 |
IsreadOnly | 获取一个值,表示SortedList是否只读 |
Item | 获取或设置与SoetedList中指定的键相关的值 |
Keys | 获取SortedList中的键 |
Values | 获取SortedList中的值 |
- SortedList类常用的方法
方法名 | 描述 |
---|---|
public virtual void Add( object key, object value ); | 向SortedList添加一个带有指定的键和值的元素。 |
public virtual void Clear(); | 从SortedList中移除所有的元素。 |
public virtual bool ContainsKey( object key ); | 判断SortedList是否包含指定的键。 |
public virtual bool ContainsValue( object value ); | 判断SortedList是否包含指定的值。 |
public virtual object GetByIndex( int index ); | 获取SortedList的指定索引处的值。 |
public virtual object GetKey( int index ); | 获取SortedList的指定索引处的键。 |
public virtual IList GetKeyList(); | 获取SortedList中的键。 |
public virtual IList GetValueList(); | 获取SortedList中的值。 |
public virtual int IndexOfKey( object key ); | 返回SortedList中的指定键的索引,索引从零开始。 |
public virtual int IndexOfValue( object value ); | 返回SortedList中的指定值第一次出现的索引,索引从零开始。 |
public virtual void Remove( object key ); | 从SortedList中移除带有指定的键的元素。 |
public virtual void RemoveAt( int index ); | 移除SortedList的指定索引处的元素。 |
public virtual void TrimToSize(); | 设置容量为SortedList中元素的实际个数。 |