You would need at the top of the code file
Imports System.Collections
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Dim allOrder As ArrayList = New ArrayList() is seamlessly working on my desktop visual studio. But in mobile Dcoder app or any vb.net compiler it says the error! Please somebody help me how to use collections on vb console in mobile compiler. [81479-screenshot-2021-03-25-17-01-12-43-5b2419c719731733.jpg][1] [1]: /api/attachments/81479-screenshot-2021-03-25-17-01-12-43-5b2419c719731733.jpg?platform=QnA
You would need at the top of the code file
Imports System.Collections
I would recommend using a List(Of T) rather than an ArrayList. No matter the following example is .NET Framework 4.8 with the standard references which if missing in the Docker container need to have them available.
In the code below you can use conventional methods to add items while I hard coded via the from
clause.
Module Module1
Sub Main()
Console.WriteLine("List")
For Each item As String In ListExample()
Console.WriteLine(item)
Next
Console.WriteLine()
Console.WriteLine("ArrayList")
For Each aItem As Object In ArrayListExample()
Console.WriteLine(aItem)
Next
Console.ReadLine()
End Sub
Function ListExample() As List(Of String)
Return New List(Of String) From {"Karen", "Anne", "Mike"}
End Function
Function ArrayListExample() As ArrayList
Return New ArrayList From {"Karen", "Anne", "Mike"}
End Function
End Module