注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
一, Hashtable按照value排序方法:使用数组排序
string[] arrKey = new string[ht.Count];//暂存 Hashtable 的键
int[] arrValue = new int[ht.Count];//暂存 Hashtable 的值
ht.Keys.CopyTo(arrKey, 0);
ht.Values.CopyTo(arrValue, 0);
Array.Sort(arrValue, arrKey);//按 HashTable 的值排序
二,两个List合并
List<int> listA = new List<int> {1,2,3,5,7,9};
List<int> listB = new List<int> {13,4,17,29,2};
List<int> Result = listA.Union(listB).ToList<int>(); //剔除重复项
List<int> Result = listA.Concat(listB).ToList<int>(); //保留重复项
|