С# Заполнение массива. Вопрос {Решено}

С# Заполнение массива. Вопрос {Решено}
int[] inventorySectionArray_X; int[] inventorySectionArray_Y;
void SetInventorySections() { int startFromSection = 3; int inventorySectionBetween_Y = inventory_W / 12; int inventorySectionBetween_X = inventory_H / 5; inventorySectionArray_X = new int[startFromSection * 5]; inventorySectionArray_Y = new int[startFromSection * 5]; for (int i = 1; i < startFromSection + 1; i++) { for (int z = 1; z < 6; z++) { inventorySectionArray_X[z - 1] = inventoryStart_X + (inventorySectionBetween_X * i - (inventorySectionBetween_Y / 2)); inventorySectionArray_Y[z - 1] = inventoryStart_Y + (inventorySectionBetween_Y * z - (inventorySectionBetween_X / 2)); //listBox2.Items.Add(inventorySectionArray_X[z - 1]); //listBox3.Items.Add(inventorySectionArray_Y[z - 1]); } } //listBox2.Items.Add(inventorySectionArray_X.Length); button5.BackColor = Color.Green; }
if (inventorySectionArray_X.Length > 0 && inventorySectionArray_Y.Length > 0) { for (int i = inventorySectionArray_X.Length - 1; i >= 0; i--) { //Здесь чет не то } }

Почему во втором цикле значения из массивов становятся нулями после 5... в то время как в листбоксы записываются все без ошибок?

4
34 комментария