List<User> users = new List<User>();
users.Add(new User("张三", "永丰路299号"));
users.Add(new User("张三", "上地西路8号"));//重复项,去重后将删掉
users.Add(new User("李四", "海鹰路甲一号"));
List<User> nonDuplicateList2 = users.Where((x,i)=>users.FindIndex(z=>z.name == x.name) == i).ToList();//Lambda表达式去重
List<User> nonDuplicateList3 = new List<User>();//通过循环方式去重
foreach(User user in users) {
if(nonDuplicateList3.Exists(x=>x.name==user.name) == false)
{
nonDuplicateList3.Add(user);
}
}