title: Loop through IEnumerable<object>
body: <p>I'm using enumerable and group by LINQ to group data from a DataTable with 5 columns. Now I need to access each column data in result. </p>
  
  <p>EDIT: </p>
  
  <pre><code>    private IEnumerable&lt;object&gt; getItemsForDisplay()
      {
             var result = toDisplay.AsEnumerable()
               .GroupBy(x =&gt; new
               {
                   Col1 = x.Field&lt;string&gt;("rItem"),
                   Col2 = x.Field&lt;string&gt;("rMaterial"),
                   Col3 = x.Field&lt;string&gt;("rSpecs")
               })
              .Select(g =&gt; new
              {
                  Col1 = g.Key.Col1,
                  Col2 = g.Key.Col2,
                  Col3 = g.Key.Col3,
                  Col4 = String.Join(", ", g.Select(row =&gt; row.Field&lt;string&gt;("rQuantity"))),
                  Col5 = String.Join(", ", g.Select(row =&gt; row.Field&lt;string&gt;("rOptional"))),
              }).ToList();
           return result;
    }
  
           //In another function
           foreach (var item in result)
          {
              //item.tostring shows this: {"aaa","bbb","ccc","ddd","eee")
              //turn it to array string or list to access "aaa".. etc etc
          }
  </code></pre>