Reputation: 61
I have a list of objects like this:
BonusesToApprove = new List<Bonus>();
I need to group it by id. I've tried several approaches like the suggestion here but the compiler returns message:
System.Collections.Generic.List<AdHoc.Objects.Bonus> does not contain a definition for 'GroupBy' ...
A sample of the code I've tried is:
var grouped = BonusesToApprove
.GroupBy ...
Can anyone tell me what I'm doing wrong?
Upvotes: 0
Views: 211
Reputation: 66439
You may have forgotten to reference the LINQ namespace in your class.
Put this at the top with any other using
statements you have:
using System.Linq;
Upvotes: 2