Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2004

Tip: Looking for answers? Try searching our database.

How to define array ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jarod - 23 Oct 2004 16:09 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.