title: Declaring and initializing a string array in VB.NET
body: <p>I was trying to return an array of strings from a function and got surprised by an error.</p>
  
  <p>I would have expected this to work, but it produces an error:</p>
  
  <pre><code>Public Function TestError() As String()
      Return {"foo", "bar"}
  End Function
  </code></pre>
  
  <p>This works:</p>
  
  <pre><code>Public Function TestOK() As String()
      Dim ar As String() = {"foo", "bar"}
      Return ar
  End Function
  </code></pre>
  
  <p>As does:</p>
  
  <pre><code>Public Function TestOK() As String()
      Return New String() {"foo", "bar"}
  End Function
  </code></pre>
  
  <p>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?</p>