Let's say I have the following classes:
class Parent
{
bool Gender { get; set; }
List<Child> Children { get; set; }
}
class Child
{
bool Gender { get; set; }
List<Child> GrandChildren { get; set; }
}
class GrandChild
{
bool Gender { get; set; }
}
Using linq, can anyone help me filter a Parent object by returning a List<Child>
where each Child has Gender == false
and each Child's GrandChild has Gender == false
?
I've managed to return a List<GrandChild>
but I really need the hierarchy to be maintained.