ArrayList:长度可变数组,不限定类型

ArrayList al = new ArrayList();

List:替代ArrayList,限定类型

List list = new List<int>();

 


Hashtable:哈希表,不限定类型

Hashtable ht = new Hashtable();


Dictionary:替代Hashtable,限定类型

Dictionary<string, string> d = new Dictionary<string, string>();

 

SortedList:可排序的列表

SortedList<int, int> sl = new SortedList<int, int>();  
sl.Add(5, 105);  
sl.add(2, 102);  
sl.Add(10, 99);  
foreach(var v in sl){  
    Cosole.WriteLine(v.Value);  
}  
// 最终排序:key值会从小到大排序

 

相关文章:

  • 2022-12-23
  • 2021-10-18
  • 2021-11-21
  • 2021-05-14
  • 2022-12-23
  • 2021-08-22
  • 2021-04-21
  • 2021-04-20
猜你喜欢
  • 2022-01-30
  • 2021-08-24
  • 2021-11-21
  • 2021-11-27
  • 2021-06-26
  • 2022-01-21
  • 2021-10-20
相关资源
相似解决方案