Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

maximum number of items in a collection and/or array

Status
Not open for further replies.

a822rms

Programmer
Feb 15, 2005
8
US
Is there a maximum number of items for collections or arrays? I have 240 codes and I'm not sure of the best way to store them.

Thanks in Advance.
 
This is a tougher question than it appears.

Both the Array class and the collection classes have a 32-bit indexer, so that would say a max of 4gb number of items. You would probably run into memory issues long before that limit.

But the Array class also has a LongLength property, which returns a 64-bit value. This represents the length in all dimensions of the array.

Neither storage method will have a problem with only 240 items. What will help you decide which to use is how you plan on accessing the data once it's in one of them. If you plan on accessing it by ordinal (index), Array is good. If you plan on accessing it by a key of some kind, then a collection (HashTable, etc) would be good.

CHip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top