title: LINQ within a foreach loop
body: <p>I have the following (note how I am using LINQ within a foreach):</p>
  
  <pre><code>foreach (string recid in recids) 
  {
       var recprec = (from rc in db.tblTrucks
                      where rc.ID == recid 
                      select rc                
                      }).FirstOrDefault();
  }
  
  if (recprec.TruckMake == "GM")...
  </code></pre>
  
  <p>I need to do some further processing based on <code>recprec</code> after the foreach but I get the following:</p>
  
  <blockquote>
    <p>recprec does not exist in the current context.</p>
  </blockquote>
  
  <p>Not sure how to fix this. I tried to do something like <code>Object recprec = null;</code> but still no luck.</p>