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);//把不重复的列加入
}
}

原文地址:https://www.cnblogs.com/SpiritWalker/p/14097365.html