c# list链表去除重复数据-hashset转list
c# list链表去除重复数据
采用哈希代码类
List<string> bb_list = new List<string> { "aa","aa","b", "b", "b" ,"c","c"}; private void RemoveRepeatItem() { HashSet<string> aa = new HashSet<string>(bb_list); int abc = aa.Count(); }
List<int> list = new List<int>();
list.Add(5);
list.Add(2);
list.Add(1);
list.Add(1);
HashSet<int> hs = new HashSet<int>(list);
list = new List<int>(hs);
欢迎讨论,相互学习。
cdtxw@foxmail.com