Ash*_*ies 2 .net c# arrays loops
我在C#中做了一个基本的2D数组,我有点困惑.
我更习惯于使用基于1的数组,所以如果你知道我的意思,基于0的数组就会让我头疼.
blocks = new Block[15, 999];
for (int x = 0; x <= 15; x++)
{
for (int y = 0; y <= 999; y++)
{
blocks[x, y] = new Dirt(terrainTexture, new Vector2(x * 16, y * 16));
}
}
Run Code Online (Sandbox Code Playgroud)
所以它告诉我,我超出了数组的范围?
如果数组来自
0-15,0-999
不应该从0-15,0-999循环工作?