且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

列表到二维数组

更新时间:2022-06-05 05:25:49

试试这个:

int i = 0;
foreach(var number in integerList)
{
    integerArray[i % 500, (int)(i / 500)] = number;
    i++;
}

如果你想让数字先在列中递增,只需将数组内部的 mod 和 div 操作转置即可.

If you want to the number to increment through the column first, just transpose the mod and div operations inside the array.