O'Reilly logo

Visual Basic 2010 Unleashed by Alessandro Del Sole

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The ArrayList Collection

System.Collections.ArrayList is the most common nongeneric collection in the .NET Framework and represents an ordered set of items. With the word ordered we mean that you add items to the collection one after the other, which is different from sorting. ArrayList collections can store any .NET type because, at a higher level, it accepts items of type Object. The following code shows how you can create a new ArrayList and how you can set how many items it can contain by setting the Capacity property:

Dim mixedCollection As New ArrayList mixedCollection.Capacity = 10

Adding new items to an ArrayList is a simple task. To accomplish this you invoke the Add method that receives as an argument the object you want to add, as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required