array list with doubles inside

eyewittness

Member
Joined
Jan 26, 2009
Messages
9
Programming Experience
Beginner
Can someone show me how to create an array list for example with doubles inside of it.

This didn't worked for me:

Dim arlist As New ArrayList
Dim i As Double
For i = 50 To -10
arlist.Add(i)
Next
 
VB.NET:
		Dim myArrayList As New ArrayList

		For d As Double = 50 To -10 Step -1
			myArrayList.Add(d)
		Next

You haven't told it how to get from 50 to -10. By leaving off the optional Step -1 it defaults to 1 meaning you're never going to get to -10.

Using Visual Studio 2005 I would recommend using a List(Of Double) instead of an ArrayList as it's type-safe and you won't need to worry about casting issues.
 
Thanks a lot. I had a lot of casting issues and now i finally have this working after 1 hour of time.
It's hard to know when to use what type of array.
 
Back
Top