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 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.