Public Function Foo() as String() Dim bar As String = {"bar1","bar2","bar3"} Return bar End Function
我想要做的只是返回字符串数组而不必先声明变量然后返回变量.
像这样的东西,虽然这显然不起作用:
Return {"bar1","bar3"}
是否有可能做到这一点,我似乎无法找到一个有效的方法?
你可以这样做:
Public Function Foo() As String() Return New String() {"bar1","bar3"} End Function