Using Array Lists

Unlike Visual Basic .NET, where you can use the ReDim statement to re-dimension an array, arrays are of a fixed size in C#. There are times when you might want to use variable-length arrays in your code, however, as when the user specifies at runtime how many items an array should have, or when you're opening various unknown databases full of records. The ArrayList class lets you add or remove elements to an array at runtime, thus creating dynamic-length arrays. You can see the significant public properties of ArrayList objects in Table 6.5, and the significant public methods of these objects in Table 6.6.

Table 6.5. Significant Public Properties of ArrayList Objects
CapacityReturns or sets the number of elements ...

Get Microsoft® Visual C#® .NET 2003 Kick Start now with the O’Reilly learning platform.

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