I've got a User table with a bitmask that contains the user's roles. The linq query below returns all the users whose roles include 1, 4 or 16.
var users = from u in dc.Users
where ((u.UserRolesBitmask & 1) == 1)
|| ((u.UserRolesBitmask & 4) == 4)
|| ((u.UserRolesBitmask & 16) == 16)
select u;
I'd like to rewrite this into the method below to returns all the users from the given roles so I can reuse it:
private List<User> GetUsersFromRoles(uint[] UserRoles) {}
Any pointers on how to dynamically build my query? Thanks