I try to take 3 rows at a time from a List of string but its not working as expected. Consider this code...
var listOfStrings = new List<string>
{
"String 1",
"String 2",
"String 3",
"String 4",
"String 5",
"String 6"
};
foreach (var x in listOfStrings.Take(3).ToList())
{
var currRows = x.ToList();
// currRows should have 3 items
foreach (var itm in currRows)
{
}
}
The first run I expect currRows to have 3 items (String 1, 2 and 3), the second time I expect to have these 3 items (String 4, 5 and 6). But when I run this currRows only contains for example "String 1" and this is split up character by character?!
What am I missing here?