score:1

you should use 'by new' after 'group'. I hope this will help you.

var entries = from entry in _db.Entries
    group entry by new { entry.Name } into groupedByName
    select new
    {
         groupedByName.Key.Name,
         NumberOfComments = groupedByName.Count(x => x.Name != null)
    };

Related Articles