Can I get an example of how to make something like a Vector or an ArrayList in Visual Basic .NET?
+1
A:
Try the following
Dim list As New ArrayList()
list.Add("hello")
list.Add("world")
For Each cur As String in list
Console.WriteLine(cur)
Next
JaredPar
2009-09-21 16:58:24
A:
Module Module1
Sub Main()
Dim al As New ArrayList()
al.Add("1")
al.Add("2")
al.Add("3")
End Sub
End Module
Chris McCall
2009-09-21 16:59:49
+7
A:
Dim list As New ArrayList
or (equivalently):
Dim list As ArrayList = New ArrayList
If you want a generic List (very similiar to ArrayList):
Dim list As New List(Of String)
cdmckay
2009-09-21 17:00:25
+1 for mentioning List(Of T) - this is a better alternative than ArrayList.
Reed Copsey
2009-09-21 17:06:22
ArrayList is going to be depricated and, from what I understand, isn't even available in some platforms such as Silverlight.
Jonathan Allen
2009-09-21 20:46:02
A:
If you happen to be using VB10 you should be able to use the following syntax.
Dim list As New List(Of Integer) From { 1, 2, 3, 4, 5 }
Brian Gideon
2009-09-21 20:44:03