I was trying to return an array of strings from a function and got surprised by an error.
I would have expected this to work, but it produces an error:
Public Function TestError() As String()
Return {"foo", "bar"}
End Function
This works:
Public Function TestOK() As String()
Dim ar As String() = {"foo", "bar"}
Return ar
End Function
As does:
Public Function TestOK() As String()
Return New String() {"foo", "bar"}
End Function
I guess I'm unclear on the meaning of the {}'s - is there a way to implicitly return a string array without explicitly creating and initializing it?