0

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?

Community
  • 1
  • 1
CodeGurl
  • 61
  • 1
  • 1
  • 6

1 Answers1

2

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;
Grant Winney
  • 65,241
  • 13
  • 115
  • 165