首页 > 编程语言 > 详细

【Unity笔记】常见集合类System.Collections

时间:2017-07-18 09:19:47      阅读:257      评论:0      收藏:0      [点我收藏+]

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值会从小到大排序

 

【Unity笔记】常见集合类System.Collections

原文:http://www.cnblogs.com/guxin/p/unity-common-collection.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!