title: Passing a constant array to a function in VB.NET
body: <p>I know that you can easily pass an array to a function, like the code below shows</p>
  
  <pre><code>Private Sub SomeFunction(ByVal PassedArray() As String)
      For i As Integer = 0 To PassedArray.Count - 1
          Debug.WriteLine(PassedArray(i))
      Next
  End Sub
  
  Public Sub Test()
      Dim MyArray As String() = {"some", "array", "members"}
  
      SomeFunction(MyArray)
  End Sub
  </code></pre>
  
  <p>But is there a way to pass a constant array to a function in VB.NET?</p>
  
  <p>For instance in PHP, you could write:</p>
  
  <pre><code>function SomeFunction($array)
  {
      for($i=0;$i&lt;count($array);$i++)
      {
           echo($array[$i]);
      }
  }
  
  function Test()
  {
      SomeFunction(array("some", "array", "members")); // Works for PHP
  }
  </code></pre>
  
  <p>So to reiterate: Is there a way to pass a constant array directly to a function in VB.NET? Is there any benefit in doing so? I imagine a few bytes of memory could be spared.</p>
  
  <p>PS.:</p>
  
  <pre><code>SomeFunction({"some", "array", "member"}) ' This obviously gives a syntax error
  </code></pre>