I tried to find out the duplicate value in a list.
However, my list's type is not primitive types, and I want to know which elements in the list are duplicate one.
For example, I have three "Person" classes in List<Person>
, people, like the following codes.
My filter is "Gender" property of Person class, and the targeted result should contain "Mary" and "Sandy" objects since their Gender's values are the same-->female.
Person Paul = new Person() { Name="Paul", Gender="male", Age="15"};
Person Mary = new Person() { Name = "Mary", Gender = "female", Age = "22" };
Person Sandy = new Person() { Name = "Sandy", Gender = "female", Age = "13" };
List<Person> people = new List<Person>();
people.Add(Paul);
people.Add(Mary);
people.Add(Sandy);