我想将其转换为通用函数:
Dim NewArray As String() = {"a", "b", "c"}
MsgBox(String.Join(vbNewLine, NewArray))
这是我尝试过的:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim IntArray As Array = {1, 2, 3} ' Integer array
Dim StrArray() As String = {"a", "b", "c"} ' String array
MsgBox(Join_Array(IntArray, vbNewLine, Integer))
MsgBox(Join_Array(StrArray, vbNewLine, String))
End Sub
Private Function Join_Array(ByVal array As Object, ByVal Separator As String, ByVal array_type As Type)
Return String.Join(Separator, array.Cast(Of array_type))
End Function