title: Nested ForEach loop to Linq
body: <p>I am trying to convert below nested for each loop into Linq. However I am still unable to do it successfully.</p>
  
  <pre><code>var objAct = new List&lt;InformaticsBenchmarkSummary&gt;();
  foreach (var item in op)
  {
      foreach (var lstTp5 in lstTopFive)
      {
          if (item.UnitOfOperations.ContainsKey(lstTp5.SystemID))
          {
              var objIbm = new InformaticsBenchmarkSummary();
              objIbm.CompanyId = item.CompanyId;
              objIbm.CompanyName = item.CompanyName;
              objIbm.LocationId = item.LocationId;
              objIbm.LocationName = item.LocationName;
              objIbm.UnitOfOperations.Add(lstTp5.SystemID, 
                                          item.UnitOfOperations[lstTp5.SystemID]);
              objAct.Add(objIbm);
          }
      }
  }
  </code></pre>
  
  <p>Where <code>UnitOfOperations</code> is of type <code>Dictionary&lt;int,string&gt;()</code>;<br>
  <code>op</code> is again <code>List&lt;InformaticsBenchmarkSummary&gt;()</code><br>
  <code>lstTopFive</code> is <code>List&lt;int&gt;()</code></p>
  
  <p>I tried, something like this but was unsuccessful syntactically</p>
  
  <pre><code>var output = from item in op
  from lstTp5 in lstTopFive
  where item.UnitOfOperations.ContainsKey(lstTp5.SystemID)
  let v = new InformaticsBenchmarkSummary()
  {
       CompanyId = item.CompanyId,
       CompanyName = item.CompanyName,
       LocationId = item.LocationId,
       LocationName = item.LocationName
  }
  .UnitOfOperations.Add(lstTp5.SystemID, item.UnitOfOperations[lstTp5.SystemID])
  select v;
  </code></pre>
  
  <p>Nested loop works perfectly but I think, linq on this will increase performance.
  Appreciate any help. </p>