The List(Of T) Collection

The System.Collections.Generic.List(Of T) collection is a generic ordered list of items. It is a strongly typed collection, meaning that it can accept only members of the specified type. It is useful because it provides support for adding, editing, and removing items within the collection. For example, imagine you need to store a series of Person objects to a collection. This can be accomplished as follows:

image

You notice that the List(Of T) has lots of members in common with its nongeneric counterpart that is the ArrayList. This is because the first one implements the IList(Of T) interface, whereas the second one implements ...

Get Visual Basic 2010 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.