Difference between a collection and arraylist?

  • Thread starter Thread starter AppleBag
  • Start date Start date
A

AppleBag

I'm new to the vb.net scene, (from vb6) and would appreciate if someone
could explain the difference between the two? From all I've read they
seem to be the exact same thing?

And as an expansion of that question, if i declare a public arraylist,
how do i view its items from any procedure I happen to be in
(app-wide), in the locals window?

thanks
 
AppleBag said:
I'm new to the vb.net scene, (from vb6) and would appreciate if someone
could explain the difference between the two? From all I've read they
seem to be the exact same thing?

And as an expansion of that question, if i declare a public arraylist,
how do i view its items from any procedure I happen to be in
(app-wide), in the locals window?

thanks
An ArrayList is a specific type of collection. This article may help clarify
the relationship.

http://msdn2.microsoft.com/en-gb/library/0ytkdh4s.aspx
 
AppleBag,

The VB6 Collection class stores key-value pairs and can be searched by
key or index where the index represents the position in the data
structure where the item is stored. If an index is not specified
during insertion then the item is added at the end.

The ArrayList only stores values. You can search by index similar to
the way all array data structures work, but you cannot search it by key
because a key is not stored.

If you reference Microsoft.VisualBasic.dll you'll be able to use a VB6
like Collection. There's really no equivalent data structure in the
System.* namespace hierarchy. The VB6 Collection is more or less an
amalgamation of ArrayList and Hashtable found in the System.Collections
namespace.

Brian
 
Thank you both very much for the explanations.

Also, regarding my OP, how can I view the items in the arraylist from
anywhere, if i declare the AL as Public on one of my forms?
 
Back
Top