I have a list of Person objects. Each Person has a list of Persons as a property. Here's the class.
public class Person
{
public List<Person> Team { get; set; }
public string Status {get; set;}
}
So each person has a parent, a list of children, and a status.
I need to count the number of times the status equals "X" or "Y" in a given person's tree. I was told I could use the .Aggregate() function, but I'm not sure how I would do that.
For example, if a Person had a list of 3 people all with status "X" and each of those people had lists of 3 people, 2 with status "X" and 1 with status "Z", that would be 12 people total and the count of "X" would be 9.