Accepted answer

You're trying to select multiple result objects for each ClassB object in the original list.

Therefore, you're looking for the SelectMany extension method:

var results = classBList.SelectMany(b => b.MyObjects).Distinct();

If you want to use query expressions, you'll need to use two from clauses:

var results = (from b in classBList from a in b.MyObjects select a).Distinct();


You want to use IEnumerable.SelectMany() Extension Method to flatten the hierarchy:

var result = classBList.SelectMany(b => b.MyObjects).Distinct();

Related Query