You can use the "select many" construct:
var columnNames = (
from autoExport in dataContext.AutoExports
where autoExport.AutoExportTemplate != null
&& ContainsColumn(autoExport.AutoExportTemplate, realName)
from column in GetDbColumnNames(autoExport.AutoExportTemplate, realName)
select column).ToList();
Or here is an alternative way to use it SelectMany:
var columnNames = (
from autoExport in dataContext.AutoExports
where autoExport.AutoExportTemplate != null
&& ContainsColumn(autoExport.AutoExportTemplate, realName)
select autoExport
).SelectMany(x => x.GetDbColumnNames(autoExport.AutoExportTemplate, realName))
.ToList();
And finally, this is another way to deliver (but it includes somewhat ugly code x => x):
var columnNames = (
from autoExport in dataContext.AutoExports
where autoExport.AutoExportTemplate != null
&& ContainsColumn(autoExport.AutoExportTemplate, realName)
select autoExport.GetDbColumnNames(autoExport.AutoExportTemplate, realName)
).SelectMany(x => x).ToList();
source
share