title: How to use LINQ to select and transform a subset of a List<T>
body: <p>I have a list <code>List&lt;UserRoles&gt; roles</code> that has this structure</p>
  
  <pre><code>{r:1,u:1,v:3},
  {r:1,u:1,v:5},
  {r:2,u:1,v:9},
  {r:3,u:2,v:10}
  </code></pre>
  
  <p>I am trying to write a LINQ statement that will filter out only the "r"s that have values 1 &amp; 2 and return a collection of ints/strings of "v"s </p>
  
  <p>This is what I am trying to do and my problem is in the part where I want to transform the  into  that holds only the corresponding "v"s.</p>
  
  <pre><code> List&lt;Int32&gt; =  roles.Where(r =&gt; r.r == 1 || r.r == 2)
                       .Select(i =&gt; new Int32{id = i.v});
  </code></pre>
  
  <p>This doesn't compile with an error that <code>'id'</code> is unknown.</p>
  
  <p>the end result that I need is this:</p>
  
  <pre><code>List&lt;Int32&gt;
  
  {v:3},
  {v:5},
  {v:9}
  </code></pre>