I have IEnumerable<Parent> AllParents. Each parent has IEnumerable<Child> Children. How can I extract all children of all parents into one IEnumerable<Child> AllChildren using LINQ?
Foreach way I'm using now:
var allChildrenList = new List<Child>();
foreach (var parent in AllParents)
{
allChildrenList.AddRange(parent.Children);
}
AllChildren = allChildrenList;