I have a query, which has one to many relation with LegalEntity table, my goal is to get a List of all LegalEntityIds. At this point I have following select which produces List<IEnumerable<string>>
, is there a quick and efficient way without looping and creating separate list to flatten the inner lists into one.
var legalEntityIds = query.Select(x => x.LegalEntities.Select(y => y.LegalEntityId)).ToList();