问个蠢问题
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = chl(New String() { "1 ", "2 ", "3 ", "4 ", "5 "})
End Sub
Public Function chl(ByVal s() As String) As String
Dim w As String = String.Empty
For Each m As String In s
w += m & "@ "
Next
Return w
End Function
End Class
为啥参数中可以new string(),而在外部却不能 dim x() as new string呢??
[解决办法]
Dim x() As String = New String() { "a ", "b ", "C "}
或者
Dim x As String() = New String() { "a ", "b ", "C "}