Click here to Skip to main content
15,916,030 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: List(Of Integer) vs. an array (VB.NET 2008) => Use List PinPopular
MicroVirus21-Jun-11 7:12
MicroVirus21-Jun-11 7:12 
GeneralRe: List(Of Integer) vs. an array (VB.NET 2008) => Use List Pin
Thomas Krojer21-Jun-11 20:46
Thomas Krojer21-Jun-11 20:46 
GeneralRe: List(Of Integer) vs. an array (VB.NET 2008) => Use List Pin
MicroVirus21-Jun-11 22:06
MicroVirus21-Jun-11 22:06 
GeneralRe: List(Of Integer) vs. an array (VB.NET 2008) => Use List Pin
Thomas Krojer22-Jun-11 0:42
Thomas Krojer22-Jun-11 0:42 
JokeRe: List(Of Integer) vs. an array (VB.NET 2008) => Use List Pin
MicroVirus22-Jun-11 1:03
MicroVirus22-Jun-11 1:03 
GeneralRe: List(Of Integer) vs. an array (VB.NET 2008) => Use List Pin
Thomas Krojer22-Jun-11 2:01
Thomas Krojer22-Jun-11 2:01 
GeneralRe: List(Of Integer) vs. an array (VB.NET 2008) => Use List Pin
Steven St. John23-Jun-11 11:40
Steven St. John23-Jun-11 11:40 
AnswerRe: List(Of Integer) vs. an array (VB.NET 2008) Pin
AspDotNetDev23-Jun-11 10:16
protectorAspDotNetDev23-Jun-11 10:16 
Read SlimList (I'm the author, but I think it's very relevant to your question). It discusses a bit about how List works. The List class basically uses an array that doubles in capacity each time capacity is reached. If you average out the time spent on each add operation, that comes to a performance of O(1) for each insert operation. Performing an array resize each time you add an item would average to O(N) for each insert operation (where N is the total number of objects inserted). Of course, you could reimplement the capacity-doubling functionality to make it O(1), but then you'd just be making List all over again. Read about big-O notation if you don't know what O(1) and O(N) mean.

Go with List. Read the above article if you want a more in-depth understanding of List (as well as an understanding of how it can theoretically be improved upon). Also, one more note: do not use SlimList. It merely demonstrates a theoretical improvement that is in practice so slow that it is not worthwile to with any real production code.

Steven St. John wrote:
I understand that using a collection would be a bad idea because of boxing/unboxing issues, but I was given to believe List(Of T) does not suffer this penalty.


The word "collection" applies to both arrays and Lists. In either case, those collections will only suffer a boxing penalty if you try to store a non-reference type in a reference variable. For example, if you put an integer into a List(Of Object). However, putting an integer into a List(Of Integer) would not cause boxing.

GeneralRe: List(Of Integer) vs. an array (VB.NET 2008) Pin
Steven St. John23-Jun-11 11:41
Steven St. John23-Jun-11 11:41 
GeneralRe: List(Of Integer) vs. an array (VB.NET 2008) Pin
AspDotNetDev23-Jun-11 12:04
protectorAspDotNetDev23-Jun-11 12:04 
QuestionRequest Pin
QASKU20-Jun-11 2:18
QASKU20-Jun-11 2:18 
AnswerRe: Request Pin
Dalek Dave20-Jun-11 13:18
professionalDalek Dave20-Jun-11 13:18 
QuestionHow to show alert when new records added to database in windows application??? Pin
Sanjay Tiwari120-Jun-11 0:10
Sanjay Tiwari120-Jun-11 0:10 
AnswerRe: How to show alert when new records added to database in windows application??? Pin
Wayne Gaylard20-Jun-11 2:12
professionalWayne Gaylard20-Jun-11 2:12 
GeneralTimer Pin
David Mujica20-Jun-11 2:45
David Mujica20-Jun-11 2:45 
QuestionUpgrade VB6 Database to VB10 Pin
Garner T19-Jun-11 11:07
Garner T19-Jun-11 11:07 
AnswerRe: Upgrade VB6 Database to VB10 Pin
RobCroll19-Jun-11 21:11
RobCroll19-Jun-11 21:11 
GeneralRe: Upgrade VB6 Database to VB10 Pin
Garner T20-Jun-11 13:14
Garner T20-Jun-11 13:14 
SuggestionRe: Upgrade VB6 Database to VB10 Pin
ChandraRam20-Jun-11 20:07
ChandraRam20-Jun-11 20:07 
GeneralRe: Upgrade VB6 Database to VB10 Pin
RobCroll21-Jun-11 2:48
RobCroll21-Jun-11 2:48 
AnswerRe: Upgrade VB6 Database to VB10 Pin
Abhinav S20-Jun-11 21:41
Abhinav S20-Jun-11 21:41 
GeneralUpgrade VB6 Database to VB10 Pin
Garner T20-Jun-11 22:35
Garner T20-Jun-11 22:35 
GeneralRe: Upgrade VB6 Database to VB10 Pin
AnnieMacD21-Jun-11 6:08
AnnieMacD21-Jun-11 6:08 
GeneralUpgrade VB6 Database to VB10 Pin
Garner T22-Jun-11 14:09
Garner T22-Jun-11 14:09 
QuestionADF Scanning Pin
ivo7517-Jun-11 7:19
ivo7517-Jun-11 7:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.