I have the following code:
var columnNames = (from autoExport in dataContext.AutoExports
where autoExport.AutoExportTemplate != null
&& ContainsColumn(autoExport.AutoExportTemplate, realName)
select GetDbColumnNames(autoExport.AutoExportTemplate, realName)).ToList();
Where the function GetDbColumns() returns an List<string>.
So columNames is of the type List<List<string>>.
Is it possible to create a List<string>, so each element of the list of GetDbColumns is added to the result of the LinQ query?
You can use the “select many” construction:
Or here is an alternative way of using
SelectMany:And finally, this is another way to put it (but it includes the somewhat ugly code
x => x):