title: VB.Net Initialising an array on the fly
body: <p>I wrote this - very simple - function, and then wondered does VB have some pre-built functionality to do this, but couldn't find anything specific.</p>
  
  <pre><code>Private Shared Function MakeArray(Of T)(ByVal ParamArray args() As T) As T()
      Return args
  End Function
  </code></pre>
  
  <p>Not so much to be used like</p>
  
  <pre><code>Dim someNames() as string = MakeArray("Hans", "Luke", "Lia")
  </code></pre>
  
  <p>Because this can be done with</p>
  
  <pre><code>Dim someNames() as string = {"Hans", "Luke", "Lia"}
  </code></pre>
  
  <p>But more like </p>
  
  <pre><code>public sub PrintNames(names() as string)
     // print each name
  End Sub
  
  PrintNames(MakeArray("Hans", "Luke", "Lia"))
  </code></pre>
  
  <p>Any ideas?</p>