Size of array in Visual Basic?

前端 未结 5 962
一向
一向 2020-12-09 09:10

I\'ve tried this code in VB:

Dim a(1) As Byte
Console.WriteLine(a.Length)

The output is \"2\". Anyone any idea why?

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-09 09:19

    Dimension Length The index of each dimension is 0-based, which means it ranges from 0 through its upper bound. Therefore, the length of a given dimension is greater by 1 than the declared upper bound for that dimension.

    Array Size in Visual Basic

提交回复
热议问题