星空网 > 软件开发 > ASP.net

SortedDictionary和SortedList

使用上两者的接口都类似字典,并且SortedList的比如Find,FindIndex,RemoveAll常用方法都没提供。

 

数据结构上二者差异比较大,SortedList查找数据极快,但添加新元素,删除元素较慢,SortedDictionary查找,添加,删除速度都比较平均。

 

博友的测试结果:

SortedDictionary和SortedList

 

直接在Unity3D里测一下

SortedDictionary和SortedListSortedDictionary和SortedList
public class Test : MonoBehaviour{  void Start()  {    var sortedDict = new SortedDictionary<string, int>();    sortedDict.Add("a01", 10);    sortedDict.Add("a10", 2);    sortedDict.Add("a03", 5);    sortedDict.Add("a02", 1);    print(sortedDict["a01"]);    foreach (var item in sortedDict)    {      Debug.Log("SortedDictionary: " + item);    }    var sortedList = new SortedList<string, int>();    sortedList.Add("a01", 10);    sortedList.Add("a10", 2);    sortedList.Add("a03", 5);    sortedList.Add("a02", 1);    print(sortedList["a01"]);    foreach (var item in sortedList)    {      Debug.Log("SortedList: " + item);    }  }}

View Code

 

调用结果:

SortedDictionary和SortedList

 




原标题:SortedDictionary和SortedList

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

tiktok国际版专线:https://www.goluckyvip.com/tag/84083.html
tiktok国际版正版:https://www.goluckyvip.com/tag/84084.html
tiktok法国版:https://www.goluckyvip.com/tag/84085.html
tiktok国际版免登陆:https://www.goluckyvip.com/tag/84086.html
tiktok快手国际版:https://www.goluckyvip.com/tag/84087.html
tiktok澳大利亚小店:https://www.goluckyvip.com/tag/84088.html
23点聊电商:新质生产力加速数字贸易发展 卓尔智联集团实现营收利润双增长 :https://www.kjdsnews.com/a/1836411.html
南京浦口都有什么好玩的地方 南京浦口都有什么好玩的地方推荐:https://www.vstour.cn/a/363180.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流