• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 4. LOOKING AT THE ACCESS COLLECT... > COMPARING CUSTOM COLLECTIONS TO ARRA...

COMPARING CUSTOM COLLECTIONS TO ARRAYS

Now you know the basics for declaring a new collection and for adding and removing elements from the collection. In the following sections, you create a simple collection of integers, as well as an array of integers. The array takes three elements, calculates the number of elements, removes an element, and displays all the elements. You should recognize the advantages of collections at the completion of this example.

Creating a Collection of Integers

The code in Listing 4.1 declares a new collection by using the New keyword, adds elements to the collection, accesses an element of the collection, lists the elements of the collection, removes an element from the collection, and then displays the number of elements in the collection. In short, Listing 4.1 demonstrates each major feature of collections. Outside remembering to use the variant data type, the code is quite intuitive and easy to follow. You can find the ShowCollectionFeatures() function in the DisplayCollectionFeatures module.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint