jpcn-coder
12/7/2018 - 4:33 PM

group using lambda

//Here's the list of DateTime functions available in LINQ. For this to work you'll also need to understand multi-column grouping
//ordered descending

var grouped = (from p in posts 
  group p by new { month = p.Create.Month,year= p.Create.Year } into d 
  select new { dt = string.Format("{0}/{1}",d.Key.month,d.Key.year), count = d.Count()}).OrderByDescending (g => g.dt);