I'd like a method that has the following API:
//get all users with a role of admin
var users = myRepository.GetUsers(u => u.Role == Role.Admin);
Will something like this work?
IList<User> GetUsers(Func<User, bool> predicate)
{
var users = GetAllUsers();
return users.Where(predicate).ToList();
}
If so, wil I be able to specify more complex predicates such as (pseudocode):
myRepository.GetUsers(u => u.CreatedDate is upto 14 days old);