title: Why doesn't IEnumerable of anonymous types return a List<object> on ToList()?
body: <p>Here is a simplified function that I want to create:</p>
  <pre><code>static List&lt;object&gt; GetAnonList(IEnumerable&lt;string&gt; names)
  {
      return names.Select(name =&gt; new { FirstName = name }).ToList();
  }
  </code></pre>
  <p>In that code block, I get the compiler error:</p>
  <blockquote>
  <p>Error CS0029  Cannot implicitly convert type 'System.Collections.Generic.List&lt;&gt;' to 'System.Collections.Generic.List'</p>
  </blockquote>
  <p>In the <a href="https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/anonymous-types#remarks" rel="nofollow noreferrer">documentation</a> for Anonymous types, it says that anonymous types are treated as type object.  Why doesn't the C# compiler return a <code>List&lt;object&gt;</code> on <code>names.ToList()</code>?</p>
  <p>Further more, why doesn't the following code cause an error?  If <code>List&lt;&lt;anonymous type: string FirstName&gt;&gt;</code> cannot be converted to <code>List&lt;object&gt;</code>, then why can it be converted to <code>IEnumerable&lt;object&gt;</code>?</p>
  <pre><code>static IEnumerable&lt;object&gt; GetAnonList(IEnumerable&lt;string&gt; names)
  {
      return names.Select(name =&gt; new { FirstName = name }).ToList();
  }
  </code></pre>