title: Aggregate objects using LINQ
body: <p>I have SQL query to get count of blocks, grouping by block name</p>
  
  <pre><code>var sql = @"select count(*) [COUNT], o.NAME from WISH w
                              left join objects o on o.ID = w.[BLOCKID]
                              where w.ISDELETE = 0
                              group by o.NAME"
  var cmd = new SqlCommand(sql, connection);
  var reader = cmd.ExecuteReader();
  Label labelClear = (Label)Master.FindControl("labelClear");
  
  if (reader.HasRows)
  {
     while (reader.Read())
     {
        labelClear.Text += reader["NAME"].ToString() + " - " + reader["COUNT"].ToString() + "; ";
     }
   }
  </code></pre>
  
  <p>which make output string like:</p>
  
  <pre><code>"BLOCKNAME1 - 15; BLOCKNAME2 - 3; BLOCKNAME3 - 28" etc.
  </code></pre>
  
  <p>(where 15, 3 and 28 - count of BLOCKNAME1, BLOCKNAME2 and BLOCKNAME3).</p>
  
  <p>And I try to convert this query to LINQ:</p>
  
  <pre><code>((Label)Master.FindControl("labelClear")).Text = 
  Db.WISH.Where(x =&gt; x.ISDELETE == 0)
  .GroupBy(x =&gt; x.OBJECTS_BLOCK.NAME)
  .Select(g =&gt; new { Name = g.Key, Cnt =  SqlFunctions.StringConvert((decimal?)g.Count()) })
  .Aggregate((a, b) =&gt; a.Name + ": " + a.Cnt + ", " + b.Name + ": " + b.Cnt );
  </code></pre>
  
  <p>But get error on last line (with Aggregate):</p>
  
  <pre><code>Cannot implicitly convert type 'string' to 'AnonymousType#2'
  </code></pre>
  
  <p>What is correct way to aggregate result into string like</p>
  
  <pre><code>"BLOCKNAME1 - 15; BLOCKNAME2 - 3; BLOCKNAME3 - 28"
  </code></pre>