What I have is a collection named HourList which is made up of Hour objects. Two of the properties on an Hour are EmployeeId and Hours. Employees punch in and out and an hour record is created. So at the end of a week I am delivered an HourList of mulipple Hour objects for mulitple employees from our DAO. It is requested that a report be made where only employees with total hours above a given threshold are displayed.
Example: A simple and flattened HourList
Id | Hours ---------- 1 | 4.5 2 | 6.0 3 | 9.9 1 | 5.5 2 | 2.5
The threshold is 10. In this case I would only want an Id 1's hour records, since his summed hours exceed 10.
I know I could do this by creating a new DAO method to handle this when I return the initial HourList. I also can do this very inefficiently with a foreach statement. I am trying to get better with Linq though and would like to see what's possible. Thank you for any help in advance.