Mark said:
What is the consensus about using the Ubound function? Should it be avoided
altogether? Is there an arry size where Ubound becomes less efficent?
I really have no objects to the Ubound function, nor do I know of any
limits on it's efficeincy.
Also, is there a better way to increase the size of an array (preserving its
current values) besides using Redim Preserve?
With a regular array object? Not really. My only advice here is to
limit the number of calls to Redim... That means don't call Redim for
every element you add - always allocate in chunks.
If what you are storing in the array are reference types (classes, not
structures) then I would suggest using an arraylist rather then a pure
array. An arraylist will grow dynamically (actually, it will
essentially do what you have to do manually with a regular array -
redim the array that is it's backing store when it needs to grow, but
it does it in chunks so you don't have to worry about it). It will
most likely give you better performance... If you are using VB.NET
2005, then I would say to use one of the generic list class. It will
give you good performance even with value types (structures). If you
using 2003 or earlier, then I would consider using a typed array if you
are storing value types and managing the array resize your self - I
would put it into a class....
I hope my rambling made sense
