List集合去重复

 1             ///获取List的集合值
 2                 foreach (DataRow row in dt.Rows)
 3                 {
 4                     list.Add(row["HJMC"].ToString());
 5                 }
 6                 //list去重复
 7                 for (int i = 0; i < list.Count - 1; i++)
 8                 {
 9                     for (int j = list.Count - 1; j > i; j--)
10                     {
11                         if (list[j].ToString().Equals(list[i].ToString()))
12                         {
13                             list.Remove(list[j].ToString());
14                         }
15                     }
16                 }
原文地址:https://www.cnblogs.com/acoll/p/3833724.html