Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / November 2006

Tip: Looking for answers? Try searching our database.

Difference between a collection and arraylist?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AppleBag - 29 Nov 2006 06:35 GMT
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
pvdg42 - 29 Nov 2006 12:16 GMT
> 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
[quoted text clipped - 5 lines]
>
> 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
Brian Gideon - 29 Nov 2006 16:56 GMT
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

> 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
[quoted text clipped - 5 lines]
>
> thanks
AppleBag - 29 Nov 2006 22:08 GMT
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?

> AppleBag,
>
[quoted text clipped - 24 lines]
> >
> > thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.