Jump to content
  • Advertisement
Sign in to follow this  
tensaix2j

Questions about VB.net collection

This topic is 4701 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there, I have a question, What is the difference between a collection and an arraylist? Using which one is more efficient?

Share this post


Link to post
Share on other sites
Advertisement
Functionality wise I think that the vb collection allows for using keys to identify elements, while the arraylist only allows indexing by order. So it's more of a dictionary vs a list.

Also, the arraylist stores the elements in an array - finding a particular index is then pretty fast, but if you go over the array size it has to reallocate it and copy values around, so you can incurr on fairly hefty performance issues.
It probably depends on what you're trying to use it for, but in general I'm willing to bet the ArrayList is better in most cases - the vb collection object was meant as a backwards compatibility class, and in general tries to be all things to everyone - usually that means sacrificing efficiency and/or memory to the altar or completeness.

One last note, the vb collection class is 1 based - I think there are other collections in the .net frameworks that are 0 based, which you may prefer using.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!