Working with Arrays

As a developer you of course know what arrays are. They are basically a place in which you can store a set of items, generally of the same type. In the .NET Framework 4.0 (as in older versions), arrays are reference types all deriving from the System.Array class and can be both one-dimensional and multidimensional.

Arrays Versus Collections

Collections, especially generic ones, are generally more efficient than arrays. I always recommend working with collections instead of arrays, except when strictly needed. (For example, you might need jagged arrays.)

You can either declare an array and use it later in your code or declare it and assign it with objects. The following is an example of declaring an array of String objects, ...

Get Visual Basic® 2010 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.