title: How to use Linq to Group By individual items in a Collection?
body: <p>I'm trying to find the most popular <code>Tags</code> that are used for a <code>BlogPost</code>.</p>
  <p>eg.</p>
  <pre><code>public class BlogPost
  {
      public int Id { get; set; }
      public IEnumerable&lt;string&gt; Tags { get; set; }
  }
  </code></pre>
  <p>So I tried:</p>
  <pre><code>var tags = (from p in BlogPosts()
          group bp by bp.Tags into g
          select new {Tag = g.Key, Count = g.Count()})
      .OrderByDescending(o =&gt; o.Count)
      .Take(number);
  </code></pre>
  <p>but this doesn't compile. Error is:
  <code>Cannot implicitly convert type 'System.Linq.IQueryable&lt;{Tag: System.IEnumerable&lt;string&gt;, Count: int}&gt;' to 'System.Collections.Generic.Dictionary&lt;string, int&gt;'.</code></p>
  <p>See how it's a list of strings? I was hoping to look through each tag in every blog post, and count the most popular ones.</p>