Order by fields in an anonymous type
问题 I am using LINQ to Objects to aggregate: var summary = from esc in objs where esc.time.Month == month && esc.time.Year == year group esc by esc.rlf_id into g select new { ID = g.Key, Total = g.Count(), Preventable = g.Where(a => a.preventable).Count() }; My query works as I would expect, but I also want to order the query by arbitrary field(s) in the anonymous type. I found LINQ: Order By Anonymous Type, but it's in VB.NET and requires strongly specifying what field to sort by. I can