473,394 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Difference between a collection and arraylist?

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

Nov 29 '06 #1
3 10472

"AppleBag" <ap******@gmail.comwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...
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
Nov 29 '06 #2
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

AppleBag wrote:
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
Nov 29 '06 #3
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?

Brian Gideon wrote:
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

AppleBag wrote:
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
Nov 29 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Red Devil | last post by:
all technical evangelist, would like to know which one is more expensive? or both is equally expensive? Your reply is much appreciated
7
by: MrNobody | last post by:
since ArrayList implements ICollection, is there a quick way to convert an ICollection into ArrayList (besides actually iterating through each element in the ICollection and explicitly adding them...
7
by: juli | last post by:
I have strings variables in a collection list and I want to create new collection but to add to it only strings that are distinct (no common strings). For example I have an object sentense which...
5
by: Keith O | last post by:
Assume fooList is an ArrayList foreach(string s in fooList) { if (some condition) { fooList.Remove(s); } } I get the following runtime error:
1
by: almurph | last post by:
Hi, Hope that you can help me please. I'm trying to implement a simple collection property using ArrayList as an indexer. i want this to be pretty generic However I'm having difficulty with...
2
by: mimi | last post by:
I would like to convert an arraylist to dataset or datatable so that I can filter or make a select distinct from it. How to do it? Can someone show me the syntax? Thanks
8
by: Jeroen | last post by:
I've been searching for this answer for some time now but I either can't find the correct search in this group, or the answer's not there yet :P Here's the problem: I'm specifying an interface,...
13
by: Murat Ozgur | last post by:
Hello, Is there any difference between ArrayList and List<object? Which one should I use ? Thanks.
2
by: softengg | last post by:
Hi, I am using a C#.Net 2 Win Application. I have copied items from a ListView to Clipboard using arraylist. But when I retrive that arralist, it shows only "System.Collection.ArrayList"....! The...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.