Can an arraylist store an array object ?

sudhanshu22

Member
Joined
Nov 8, 2006
Messages
20
Programming Experience
Beginner
Hi all,
I have a class for which I created an array of objects. can I store this array in an arraylist ?
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,726
Location
Sydney, Australia
Programming Experience
10+
You can store anything in an ArrayList but I'm not convinced that you realise exactly what you're asking. Do you mean that you want to store multiple arrays in the one ArrayList? If so then the answer is "yes" because, as I said, you can store anything in an ArrayList. If you only intend to store a single array in the ArrayList then you're going about things the wrong way.

An ArrayList is intended to be an alternative to an array, specifically to allow dynamic resizing and ordering of the objects it contains. It's conceivable that you'd want a collection of arrays but not likely.

Also, the ArrayList should be very rarely used in VB 2005. It is generally preferable to use a generic List instead, so that you can specify the type of the items it will contain.
 
Top Bottom