We help IT Professionals succeed at work.

VB.net code error relating to lists

Murray Brown
Murray Brown used Ask the Experts™
on
Hi. In the code below, I am getting the error on the word "List" in the first line
 
"Too few type arguments to System.Collections.Generic.List(of T)

  Public Function ListToString(l As List) As String
        Dim s As String, out As String
        out = ""
        For Each s In l
            out = out & s & ";"
        Next
        Return out
    End Function
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
You must specify the type of the List, so in this case I believe it should be:
l as List(of String)

Open in new window

Commented:
Do:
Public Function ListToString(l As List(Of String)) As String
   Return Join(l.ToArray, ";")
End Function

Open in new window

Murray BrownASP.net/VBA/VSTO Developer

Author

Commented:
Thanks very much