Dim List1 As New List(Of String)
List1.Add("1")
List1.Add("2")
List1.Add("3")
Dim Str1 As String = List1.ToString
Str1的结果怎么变成 System.String[] 这个内容呢
应该是123。却是System.String[]
这个如何解决呢,还是用其他方法?
------解决思路----------------------
Strings.Join(List1.ToArray(),"")
------解决思路----------------------
Class MyList
Inherits List(Of String)
Public Overrides Function ToString() As String
Return String.Concat(Me)
End Function
End Class
Module Module1
Sub Main()
Dim List1 As New MyList
List1.Add("1")
List1.Add("2")
List1.Add("3")
Dim Str1 As String = List1.ToString
Console.WriteLine(Str1)
End Sub
End Module
------解决思路----------------------
String.Join(",", List1)