Hello
I am curious how should I use the array of doubles. The problem is I don't
know in advance how much elements would it have, but I can be sure it will be
less then let's say 150 or 500. So should I define the largest one or use an
arraylist ? I don't resize it, because after a few calculation the
application will be closed. It works like that : read the file, make
calculations, save the file , close. I could count the rows in a file and
then define an array but isn't it waste of time ?
Jarod
Herfried K. Wagner [MVP] - 23 Oct 2004 16:46 GMT
"Jarod" <Jarod@discussions.microsoft.com> schrieb:
> I am curious how should I use the array of doubles. The problem is I don't
> know in advance how much elements would it have, but I can be sure it will be
[quoted text clipped - 3 lines]
> calculations, save the file , close. I could count the rows in a file and
> then define an array but isn't it waste of time ?
If you know the maximum number of items and it's not too high, use an array.
If you know the avg. line length, divide the length of the file by the avg.
line length and use this number + n as size for your array.
If you don't know anything about the data, an arraylist might be the better
choice.

Signature
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/
chanmmn - 23 Oct 2004 17:39 GMT
Don't use array and try to use collection instead. We are talking about
VB.NET and not C language. In C you need a hard pointer for dynamic memory
but in today VB.NET you can use collection.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vaob
jCollection.asp
good luck.
chanmm
> Hello
> I am curious how should I use the array of doubles. The problem is I don't
[quoted text clipped - 7 lines]
> then define an array but isn't it waste of time ?
> Jarod