如何循环3D数组?

时间:2016-01-22 21:04:55

标签: arrays vb.net

我正在尝试循环播放3D数组。这是使用常规for循环的正确方法吗?

' declare variable
Dim cube(2, 2, 3) As Integer

' loop through pages
For i As Integer = 0 to cube.GetUpperBound(2)

  ' loop through rows
  For j As Integer = 0 to cube.GetUpperBound(0)

    ' loop through columns
    For k As Integer = 0 to cube.GetUpperBound(1)

      ' fill array
      cube(i, j, k) = i + 1

    Next k

  Next j

Next i

0 个答案:

没有答案