I’m trying to do use linq in a way to avoid doing a foreach over DataRows in a DataSet:
var results = from dataRow in DataRows
let MoreData = func(dataRow.ID)
join moreDataRow in MoreData on dataRow.ID2 = moreDataRow.ID2
select new
{
ID1 = dataRow.ID,
ID2 = dataRow.ID2,
ID3 = dataRow2.ID3
};
I’d like to accomplish something like the above, but linq cannot use the MoreData as part of the join statement. If I’m unable to do that I may result to just doing a foreach on DataRows and going from there.
Is there a linqy way to join on data that won’t be available until iterating over an element and then performing a join from the original data to the newly generated data as above?
A
joinclause has to take a complete collection – not something which depends on the current row. You can use multiplefromstatements though: