Arrays and Collections

Arrays have undergone a couple of changes in VB .NET. Originally (beta 1) arrays were designed to contain n elements with indexes from 0 to n-1, where n represents the number of elements in the array. The Option Base statement is no longer supported. In beta 2, arrays were reverted back to VB6 Option Base 0 arrays. An array declared as follows

Dim A(10) As Type
					

contains n + 1 elements indexable from 0 to n. The sample array contains 11 elements. You can still use LBound and UBound to manage the array bounds, use the Array. GetLowerBound and Array.GetUpperBound methods, or always use the lower bound limit of 0.

In addition to changes in arrays, new abstract data types (ADTs), including ArrayList, BitArray, Dictionary

Get Visual Basic® .NET Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.