David Smith

David Smith

  • NA
  • 2k
  • 0

c# Linq Take Selected Records

Oct 26 2017 5:46 PM
I need to loop to each table getting or taking 2 records at time until all tables have been iterated through or empty. So I want to use Linq to do this. I am assuming a while loop is needed overall instead of a foreach. The logic should go
 
-Take 2 records, do something, then proceed to next table,
-take 2 records do something, then proceed to next table.
-Once you have reach the last table, go back to the beginning of the collection of the tables and repeat the process. We cannot exit the loop until all tables have process all records
 
Color Table 1:
ID | Item
1 | red
2 | blue
3 | green
 
Color Table 2:
ID | Item
1 | red
2 | blue
3 | green
4 | brown
 
Color Table 3:
ID | Item
1 | red
2 | blue
3 | green
4 | brown

Answers (2)