Alex Rivera | Logout

Size of array in Visual Basic?

Asked 2009-02-03T06:59:12.153
30

I've tried this code in VB:

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

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

Edit
Report

1 Answer

8

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

answered 2009-02-03T07:06:44.023

Your Answer