I wrote this - a very simple function, and then I wondered if VB has some built-in functions for this, but could not find anything specific.
Private Shared Function MakeArray(Of T)(ByVal ParamArray args() As T) As T() Return args End Function
Not much to use as
Dim someNames() as string = MakeArray("Hans", "Luke", "Lia")
Because it can be done with
Dim someNames() as string = {"Hans", "Luke", "Lia"}
But more like
public sub PrintNames(names() as string) // print each name End Sub PrintNames(MakeArray("Hans", "Luke", "Lia"))
Any ideas?
Binary binary
source share