I am wanting to loop through this list of name value pairs and grab them in groups of 4.
The data would be like:
value1 1 value2 1 value3 1 value4 1
This will group by every 4 items (a, b, c, d), (e, f, g, h), (i, j)
var abc = new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j" }; var xyz = abc.Select((e, i) => new { Item = e, Grouping = (i / 4) }).GroupBy(e => e.Grouping);