title: Why can't I use the array initializer with an implicitly typed variable?
body: <p>Why can't I use the array initializer with an implicitly typed variable?</p>
  
  <pre><code>string[] words = { "apple", "strawberry", "grape" };                 // legal
  string[] words = new string[]{ "apple", "strawberry", "grape" };     // legal
  var words = new []{ "apple", "strawberry", "grape" };                // legal
  var words = new string[]{ "apple", "strawberry", "grape" };          // legal
  
  var words = { "apple", "strawberry", "grape", "peach" };             // ILLEGAL
  </code></pre>
  
  <p>Is there a technical reason for this limitation? Why can't it infer the type like it would for:</p>
  
  <pre><code>var number = 10;
  var text = "Hello";
  </code></pre>
  
  <p>The compiler clearly knows what I am trying to do, it just won't allow it:</p>
  
  <blockquote>
    <p>CS0820: Cannot assign array initializer to an implicitly typed local</p>
  </blockquote>
  
  <hr>
  
  <p>Update: I compiled a program using the four legal array declaration methods, and it generates the same IL: <a href="http://pastebin.com/28JDAFbL" rel="noreferrer">http://pastebin.com/28JDAFbL</a></p>
  
  <p>This just adds to my confusion. And "it is like this because the spec says so" is of little help. Why is the spec like this? What is the rationale here?</p>