C#中List和SortedList的简介

2020-01-05 09:53:51王振洲

下表列出了一些排序列表(SortedList)类的常用方法:

  • void Add( object key, object value );   将带有指定键和值到排序列表的元素
  • public virtual void Clear();   将删除SortedList的所有元素
  • public virtual bool ContainsKey( object key );   确定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 );   返回在排序列表中指定键从零开始的索引
  • 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元素的实际数量

    总结

    以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对ASPKU的支持。