As Peter B. and Peter K. pointed out, an ArrayList or a generic List are
probably better, but be aware that you can resize arrays in .NET.
In .NET 2, you can use Array.Resize to resize single dimension arrays. Be
aware that it does copy the contents to a new array internally on each
'Resize' call. This is the main reason why the alternatives mentioned are
faster.
For multi-dimensional arrays, you can use the approach I discuss here:
http://www.tangiblesoftwaresolutions...20Preserve.htm
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter & VB to C++ converter
Instant J#: VB to J# converter
"Larry Charlton" wrote:
Is there a high performance way in .Net to dynamically build single dimension
arrays when the number of elements in the array is unknown until after the
array is built? (i.e. I only need the array to grow, I don't need to remove
elements)
I noticed that Dim myVar As List(of X) gets converted to Dim myVar() As X
when returned from a web service. I'd like to build a single code base that
supports either using web services (Tiers) or tightly linked assemblies
(Layers). It would appear for that to work I'll need to use Arrays instead
of the new generics.
Thanks,
Larry