List<Person> perlist = new List<Person>()
{
new Person(){ Name="hello",Id="first",age=1 },
new Person(){ Name="hello",Id="second",age=2},
};
var ace = new Person() {Name="hello",Id="first",age=1 };
perlist.Remove(ace);//无法删除相同属性无法删除
perlist.Add(ace);
perlist.Remove(ace);//成功删除相同地址
List<Person> list_person = new List<Person>();
list_person = perlist.FindAll(per => per.Name == "hello");
//找到所有Name为"Hello"的person
c# list存储集合类型
于 2024-03-03 17:12:31 首次发布