using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2
{
internal class Program
{
public static void Main()
{
var modelList = new List<Moon>();
for (int i = 1; i <= 22; i++)
{
modelList.Add(new Moon()
{
idx = i,
name = System.Guid.NewGuid().ToString()
});
}
List<List<Moon>> groupsOf10 = modelList
.Select((str, index) => new { str, index })
.GroupBy(x => x.index / 10)
.Select(g => g.Select(x => x.str).ToList())
.ToList();
foreach(var groupInfo in groupsOf10)
{
foreach(var info in groupInfo)
{
Console.WriteLine($"{info.idx} {info.name}");
}
Console.WriteLine("============================");
}
Console.ReadKey();
}
}
public class Moon{
public int idx { get; set; } = 0;
public string name { get; set; } = "";
}
}