|
-
Mar 7th, 2023, 10:02 AM
#6
Re: Visual Basic .NET - Which Collection Should I Use?
 Originally Posted by dday9
Yes, that is still the case. The List(Of T) was not introduced until the .NET framework 2.0 so I included it in the FAQ just in case.
There was the ArrayList class before the List(Of T) was introduced. It works the same way except for the fact that it was non-generic. It was could contain Integers and Strings at the same time and it was less performant due to all the boxing that would happen with primitive types like Integers and Doubles. This is why it was superseded by the List(Of T). The List(Of T) offered type safety and performance the ArrayList didn't.
I would also note in this case that Redim Preserve may have been preferable to ArrayLists since arrays were as close to generics as one could come in the pre-generic era of .Net. You could use it to implement your own resizable List that avoids the penalty of boxing and offers the safety of strong typing.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|