title: for each loop in view in mvc
body: <p>i have written the following code in my view and i have to print value of  variables of my forloop  variables company in my view how can i do this</p>
  
  <pre><code> &lt;table&gt;&lt;tr&gt;
  
  
          &lt;td&gt;
          &lt;% 
          var ResDet1 = (from r in db.Res_Exp
                             where r.Resume.ResumeID == 191
                             select new{r.ResExpID,r.Company}).ToList();
          string company;
                                  int exprinceid;
              if (ResDet1 != null)
              {
  
                  foreach (var rc in ResDet1) 
                  {
  
                      exprinceid = rc.ResExpID;
                      company = rc.Company; 
  
                  }
  
              }
         %&gt;
       &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  </code></pre>