I’m posting this here because I keep forgetting the syntax, and thought others might benefit as well.
Given :
public class ParentItem
{
IEnumerable<ChildItem> Children
}
Selecting all the childitem instances from an IEnumerable<ParentItem>:
var allChildren = ParentItems.SelectMany(parent=>parent.Children);
Selecting matching childItem instances from an IEnumerable<ParentItem>:
var selectedChildren = ParentItems.SelectMany(parent=>parent.Children).Where(child=><boolean expression for filtering children>)