Richard's answer is the best for your needs. It may be easier on the memory to use an enumerable if you have a lot of data to process. This example uses Linq
to group the data into sets each containing 16 values. It uses an IEnumerable<int>
as it's easy to initialise. I'm not suggesting that you use it but it may be useful in other similar applications
static void Main(string[] args)
{
var x = Enumerable.Range(0, 128);
int s = -1;
var sets = x.Select((v, i) =>
(Set: (i % 16 == 0) ? ++s : s, Value: v))
.GroupBy(a => (a.Set), (key, values) => (key, values));
foreach (var (key, values) in sets)
{
Console.WriteLine(key);
string spacer = string.Empty;
foreach (var (Set, Value) in values)
{
Console.Write($"{spacer}{Value}");
spacer = spacer == string.Empty ? ", " : spacer;
}
Console.WriteLine();
}
Console.ReadLine();
}