I have an array of String and I have to convert it to an ArrayList. Is it possible to do it in VB.Net?
1 Answer
Try this
Dim sArray() as String 'array of strings
...
Dim aList as ArrayList = New ArrayList(sArray)
4 Comments
CiccioMiami
Thanks but it does not work since ArrayObject has to implement IList and the way array implements IList is a bit awkward
CiccioMiami
thanks but that one is Java...and VB6 does not have ToList() method for arrays
Java
can't we do like this Dim AList as ArrayList = New ArrayList(StrArry); // StrArry will be our array of strings?
CiccioMiami
yes it works, update your answer and you get the points ;-) Thanks!
Dim AList as ArrayList = New ArrayList(StrArry)VB6 only supports parameterless constructors. I am editing your question, tags, etc