Login   /   Register

Retrieve ArrayList information

Rate this article
     0 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 5
Loading ... Loading ...
April 1st, 2008 by daniva

The ArrayList object Implements the IList interface using an array whose size is dynamically increased as required.

The Capacity property gets or sets the number of elements that the ArrayList can contain.

The Count property gets the number of elements actually contained in the ArrayList.

The IsFixedSize property gets a value indicating whether the ArrayList has a fixed size.

Set array1 = CreateObject( "System.Collections.ArrayList" )
Set array2 = CreateObject( "System.Collections.ArrayList" )
 
Private Sub PrintInfo( ByVal title )
   Print title
   Print "array1 Capacity = " & array1.Capacity
   Print "array2 Capacity = " & array2.Capacity
   Print "array1 Count = " & array1.Count
   Print "array2 Count = " & array2.Count
   Print "array1 IsFixedSize = " & array1.IsFixedSize
   Print "array2 IsFixedSize = " & array2.IsFixedSize
   Print String( 50, "*" )
End Sub
array2.Capacity = 10
Call PrintInfo( "Before adding items." )
' ** Adding an item to arrays
array1.Add "New York" : array2.Add "New York"
Call PrintInfo( "After adding 1 item." )
array1.Add "Boston" : array2.Add "Boston"
array1.Add "Dallas" : array2.Add "Dallas"
array1.Add "Chicago" : array2.Add "Chicago"
Call PrintInfo( "After adding 3 more items" )
array1.Remove( "Boston" )
Call PrintInfo( "After removing 1 item form array1" )

Posted in Collections.ArrayList

Leave a Reply

You must be logged in to post a comment.

This article was viewed 358 times