Using Simple Arrays

The System.Array class represents a simple collection of objects. In fact, you never instantiate this class directly. Instead, you use the built-in language features. The following C# example illustrates the use of the Array class:

int[] myIntArray = new int[10];

You code the same thing in Visual Basic .NET in one of two ways:

Dim myIntArray() As Integer = New Integer(9) {}
Dim myIntArray(9) As Integer    ’implies New Integer(9)

In C#, you must use the new language keyword to initialize an array. If you leave it out, the array variable is uninitialized and points to nothing.

You must include the initialization braces {} when declaring an array in Visual Basic using the New keyword, even if you do not supply any initialization values; ...

Get Microsoft® .NET Compact Framework (Core Reference) 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.