I have a list of class A, class A contains a list of class B. I want to operate on all instances of B within all instances of class A.
var myListOfA = new List<A>();
class A
{
public List<B> ListOfB;
}
How can I iterate over all B i.e. foreach(var b in myListOfA.ListOfB){}?
You can use SelectMany:
See it in action at ideone.com.