GodfatherSaint
GodfatherSaint

Reputation: 67

Group a List of Data by Date

I have a List that contains data from various dates. I would like to create a sub list of data that only contains information from a certain interval such as today all the way back to 6 months ago.

var results = Bean.GroupBy(dc => new {dc.serviceType, dc.periodType}).Select( WHAT GOES HERE?)

period is the name of the interval of time in my list

I want something like: period between Date1 and Date2

Thanks

Upvotes: 0

Views: 49

Answers (1)

lajjne
lajjne

Reputation: 697

What about:

var results = Bean.Where(x => x.period > Date1 && x.period < Date2).GroupBy(dc => new {dc.serviceType, dc.periodType})

Upvotes: 1

Related Questions