list 去重方法之一
作者:互联网
List<SupplierBase> yuanList = new List<SupplierBase>();
yuanList = ShareDal.GetCompanyListByTagId(tagId);
CompanyList = new List<SupplierBase>();
Hashtable hash = new Hashtable();
foreach (var item in yuanList)//源LIST去重
{
if (!hash.ContainsKey(item.CompanyID))
{
hash.Add(item.CompanyID, item);
CompanyList.Add(item);//把不重复的列加入
}
}
标签:之一,hash,CompanyID,List,yuanList,list,item,new,方法 来源: https://www.cnblogs.com/SpiritWalker/p/14097365.html