i am writing a class with function to add in element to array.

eg.

VB Code:
  1. public class Something
  2.  
  3.    private arrData(0) as string
  4.  
  5.    sub new()
  6.  
  7.    end sub
  8.  
  9.    public function addData(byval strData as string)
  10.  
  11.       redim preserve arrData(ubound(arrData)+1)
  12.  
  13.       arrData(ubound(arrData)) = strData
  14.  
  15.    end function
  16.  
  17. end class


The above will keep on redim the array and add 1 more space to the array.

May i know is there any other way to add an element to an array without keep on redim-ming.

May i know if i keep on using the .addData function many times to add many data, will the "redim preserve", ie keep on redim the array affect the the performance.


Is there any disadvantage to use redim preserve?

Please advise.

Thanks.