3

I have a collection of "ParentEntity", each one of which has a collection of "ChildEntity".

I'd like to select ALL of the ChildEntity as a single collection.

var children = from p in parents
 select p.Children;

Returns a collection of ChildEntity collections?

I'd like to get a single collection of all the Children, rather than a collection of collections.

BlueChippy
  • 5,935
  • 16
  • 81
  • 131

1 Answers1

10
var children=parents.SelectMany(p=>p.Children)
Jayantha Lal Sirisena
  • 21,216
  • 11
  • 71
  • 92