Blog Stats
  • Posts - 55
  • Articles - 0
  • Comments - 8
  • Trackbacks - 0

 

StringCollection Internals

DisguiseA search comparing the StringCollection to the ArrayList may give you articles that say "the ArrayList works better than the StringCollection" but what you need to know is that a StringCollection is simply extra methods over an ArrayList - there is an actual ArrayList included as a private member within the StringCollection class and it caters to storage needs of StringCollection. In other words, the StringCollection is just a disguised ArrayList!

You don't really have to decide between using an ArrayList or the StringCollection wrapper - both are essentially the same! You use a StringCollection wrapper when you are dealing with strings... the cast to a string is performed by a method in the wrapper so you don't have to do it each time you access it. If you aren't dealing with strings, the StringCollection isn't an option anyway.

Feedback

# re: StringCollection Internals

Gravatar Just use a List of String. Array lists are pretty much obsolete. 7/8/2008 8:59 PM | Josh

Post a comment





 

Please add 8 and 6 and type the answer here:

 

 

Copyright © Nitin Reddy Katkam