title: Dataset to List with Linq
body: <p>I have a dataset with one table. I would like to convert this table in a list with Linq.</p>
  
  <p>This code works fine:</p>
  
  <pre><code>var list = dsUniqueIds.Tables[0].AsEnumerable()
                        .Select(r =&gt; new { column1 = r.Field&lt;string&gt;("UniqueIDs") }).ToList();
  </code></pre>
  
  <p>But when I try to change the cast in a list like this:</p>
  
  <pre><code>List&lt;string&gt; list = dsUniqueIds.Tables[0].AsEnumerable()
                                 .Select(r =&gt; new { column1 = r.Field&lt;string&gt;("UniqueIDs") })
                                 .ToList();
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>Cannot implicitly convert type
  'System.Collections.Generic.List&lt;AnonymousType#1&gt;' to
  'System.Collections.Generic.List&lt;string&gt;
  </code></pre>
  
  <p>I need this data in a list for an autocomplete on a textbox with jQuery.
  To get the data to the jQuery I use JavaScriptSerializer and Serialize(list).
  Serialize(list) doesn't work with a var. If I use a var I only get objects at the JavaScript.
  This works fine if I fill the list with a foreach. But I want to try it with Linq and I have no idea why it won't work.</p>
  
  <p>Anyone knows why this doesn't work?</p>