We need to transpose data from the rows in a table to the output table such that that multiple rows are returned for every row in the input table. The logic for extracting data in each row of the output depends if value is present in a given column in the input row.
For e.g.
Input table
A, B, C, D, E, F
Output table
A, B, C, [if value present in D then some operation on value in D]
A, B, C, [if value present in E then some operation on value in E]
A, B, C, [if value present in F then some operation on value in F]
For doing this I intend to something like this:
private IEnumerable<OutputRow> BuildOutputTable(DataTable inputTable)
{
var outputRows = from inputRow in inputTable.AsEnumerable()
select new outputRow(inputRow, *delegateToProcessor*);
return gbbOutputRows;
}
But this will need me to iterate through for each of the additional value columns. Can I avoid that and just pass a single delegate so that the 'select new outputrow' returns me multiple rows?