List一键移除集合重复数据

方法一

List<int> list = new List<int>(); list.Add(1); list.Add(1); list.Add(2); list.Add(2); list.Add(3); list.Add(3); list = list.Distinct().ToList(); //list里只有1,2,3


方法二
 List<string> listBuildCenterInformationCode = new List<string>();

  HashSet<string> hs = new HashSet<string>(listBuildCenterInformationCode);
  listBuildCenterInformationCode = hs.ToList();

 
原文地址:https://www.cnblogs.com/fenger-VIP/p/6277463.html