I have a list of Clubs that has a list of Member property in it. How do I get a List of unique members?
Here's why this question is different than what you're suggesting as duplicate: This is a bit different than the example in that one of the properties of my class is another class -- not a simple int or string.
My class looks like this:
public class Club
{
public int Id { get; set; }
public string ClubName { get; set; }
public List<Member> Members { get; set; }
}
And the member class looks like this:
public class Member
{
public Guid Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime MemberSince { get; set; }
}
To illustrate the point a bit more...
var myClubs = new List<Club>();
myClubs = getSomeData();
var uniqueMembers = myClubs.Select()...