Sorry, that title just hurts. I'm wondering if there is a Linq to collections extension method that collapses the following code segment into a single line:
public IEnumerable<Child> GetAllChildren(IEnumerable<Parent> parents){
var result = new List<Child>();
foreach(Parent parent in parents)
foreach(Child child in parent.Children)
result.Add(child);
return result;
}
If you can collapse that into a single statement, try it on insane difficulty:
public IEnumerable<Child> GetAllChildren(IEnumerable<Grandparent> nanas){
var result = new List<Child>();
foreach(Grandparent papa in nanas)
foreach(Parent parent in papa.Children)
foreach(Child child in parent.Children)
result.Add(child);
return result;
}