I have a class and a list of it like this:
public class Person {
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime Birthday { get; set; }
}
// and my list is:
var persons = new List<Person>();
persons.add(/* add for example 20 person here */);
These persons may have duplicate FirstName
and LastName
. I want to select a subsequence of persons that all FirstName
vs LastName
are diferent. I mean my primary-key (in a relational db vision) is FirstName + LastName
.
I know I can do this by iterating the list. But I'm asking a LINQ
solution. Is there any one? May I select the specified subsequence by LINQ
? Any idea please?