How to combine elements of List type properties of another list elements into one list using LINQ

Viewed 43

Let's say I have a list of elements of some type A:

List<A> listA;

And each A class has a member which is a list of type B:

class A
{
    List<B> listB;
}

What should be my LINQ query to combine all B elements of all listBs from A elements in the listA? Of course I can traverse through the listA and keep adding to a new List<B> all listBs, but I'd like to get it done by LINQ query.

0 Answers
Related