class order {
Guid employeeId;
DateTime time;
}
I need to filter a list of orders into 4 lists based on the time range. 0-9AM to 1st list, 9AM-2PM to 2nd, 2-6PM to 3rd and 6-12PM to a 4th list.
I am curious if this can be achieved using lambda expressions in a efficient way? otherwise what would be the best way to split the list?
This should work:
Here’s another, maybe more efficient, more flexible and concise approach which uses
Enumerable.GroupBy: