By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,717 Members | 2,069 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,717 IT Pros & Developers. It's quick & easy.

Create an Unknown Number of ArrayLists

P: n/a
I would like to create an unknown number of Arraylists, meaning, I don't know
how many I should create until runtime.

I will be reading a table, and 0,1,2, or more fields have to be put into
individual ArrayLists.

How do I create an unknown number of ArrayLists?

Right now I put all the values into one ArrayList. I know how many fields
are in the ArrayList so I then know that every one, or every other one, or
every third one goes together. I would like three separate lists, OR, a way
to enumerate the fields as I put them in the one ArrayList.

I do know how many fields I have at runtime.
Nov 1 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Andy in S. Jersey wrote:
How do I create an unknown number of ArrayLists?
How about a list of lists?

--

..NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.
Nov 1 '06 #2

P: n/a
I don't necessarily know the type of collection I want to make. Will List
still be OK?

That's what I like about ArrayList, any type can be put in.

"Jon Shemitz" wrote:
Andy in S. Jersey wrote:
How do I create an unknown number of ArrayLists?

How about a list of lists?

--

..NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.
Nov 1 '06 #3

P: n/a
i have done something similar,

but what I did was create a class with properties,
and make that class into an array.

As I need to create more elements, I use a Redim with a preserve on it.
I know it says this takes more time and such, but ill take the extra 2
seconds of processing time :)
-it made my life easier down the road.

M.
"Andy in S. Jersey" <An***********@discussions.microsoft.comwrote in
message news:6E**********************************@microsof t.com...
>I don't necessarily know the type of collection I want to make. Will List
still be OK?

That's what I like about ArrayList, any type can be put in.

"Jon Shemitz" wrote:
>Andy in S. Jersey wrote:
How do I create an unknown number of ArrayLists?

How about a list of lists?

--

..NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.

Nov 1 '06 #4

P: n/a
Andy in S. Jersey wrote:
I don't necessarily know the type of collection I want to make. Will List
still be OK?

That's what I like about ArrayList, any type can be put in.
I did mean an ArrayList of ArrayList-s or (better) a
List<List<object>>.
How do I create an unknown number of ArrayLists?
How about a list of lists?
--

..NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.
Nov 1 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.