Invalid anonymous type member declarator

You have to name the property used to store Sum method result:

select new { g.Key.empid, g.Key.weekending, Sum = g.Sum(s=>s.hours)};

Compiler can’t infer the property name when you’re assigning the value from expression:

Anonymous Types (C# Programming Guide)

You must provide a name for a property that is being initialized with an expression (…)

Leave a Comment