Here's the simple scenario:
var q = from i in icdPatientList
group i by i.PatientId into grp
select new
{
Key = grp.Key,
//trailing comma causes no compile-time error
Count = grp.Count(),
};
foreach (var item in q)
{
//simple columns + counts
Console.WriteLine(item.Key + " " + item.Count);
}
Why is it that in the projection having a trailing comma with nothing after it does not cause a compile-time error? Having two commas does, and of course having none works perfect as well.