473,585 Members | 2,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10491

"AppleBag" <ap******@gmail .comwrote in message
news:11******** **************@ 80g2000cwy.goog legroups.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.Visua lBasic.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.Collecti ons
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.Visua lBasic.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.Collecti ons
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
886
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
23531
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 to a new ArrayList instance) ??
7
2709
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 is the base for a collection and there are words in it and I want to create a new collection of sentenses where there is no similar secound word in...
5
1873
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
1070
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 the conversions. I know that System.Collection.ArrayList accepts and returns most of it's members as objects but it's giving an error message of:
2
13371
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
3331
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, that will have an ArrayList property (at least, I'd very much *like* to use such a property). The only problem is: I want the list only to accept...
13
31240
by: Murat Ozgur | last post by:
Hello, Is there any difference between ArrayList and List<object? Which one should I use ? Thanks.
2
2352
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 Code shows below... ArrayList dataObjects = new System.Collections.ArrayList(); IDataObject clipboardData = Clipboard.GetDataObject(); string...
0
7835
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8195
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8334
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7947
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8209
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5707
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3831
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2340
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1444
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.