title: Convert a IEnumerable<AnonymousType#1> to List<string>
body: <p>I want a <code>List&lt;string&gt;</code> containing all the 'selected' series codes from this DataGridView:</p>
  
  <p><img src="https://i.stack.imgur.com/3Vxgu.png" alt="enter image description here"></p>
  
  <p>I can get them as DataGridViewRow's, eg:</p>
  
  <pre><code>List&lt;DataGridViewRow&gt; selectedSeriesCodes =
                  gridSeriesList.Rows.Cast&lt;DataGridViewRow&gt;().Where(g =&gt;
                      !string.IsNullOrEmpty(g.Cells[ListDataSource.gridColumn1].Value.ToString()) &amp;&amp;
                      Convert.ToBoolean(g.Cells[ListDataSource.gridColumn1].Value) == true).ToList();
  </code></pre>
  
  <p>But I am aiming to get them as a <code>List&lt;string&gt;</code> purely for separation of concerns as I dont want to pass controls into business logic to ease testing, and just a fyi this is a excel vsto add-in.</p>
  
  <p>I thought using LINQ with an anon type would do the trick, but it wont compile, eg:</p>
  
  <pre><code>List&lt;string&gt; selectedSeriesCodes = from x in gridSeriesList.Rows.Cast&lt;DataGridViewRow&gt;()
                                         where (!string.IsNullOrEmpty(x.Cells[ListDataSource.gridColumn1].Value.ToString()) &amp;&amp;
                                          Convert.ToBoolean(x.Cells[ListDataSource.gridColumn1].Value) == true)
                                         select new { SeriesCode = x.Cells[ListDataSource.gridColumn2].ToString() };
  </code></pre>
  
  <blockquote>
    <p>Error 'System.Collections.Generic.IEnumerable<code>&lt;AnonymousType#1&gt;</code>' to
    'System.Collections.Generic.List<code>&lt;string&gt;</code>'. An explicit conversion
    exists (are you missing a cast?)</p>
  </blockquote>
  
  <p>I am sure this is possible, otherwise I'll just use a for loop.</p>