I'm currently reading an article , but I do not really understand how this work with the logical operator. Can anyone explain this to me?
eg. If I want to have 4 level securities with customer, employee, supervisor and Admin.
[Serializable]
[Flags]
public enum WebRoles
{
customer= 1 << 0,
employee= 1 << 1,
supervisor = 1 << 2,
Admin = 2 << 3
}
and then how I should implement the following logic.
if (Roles != 0 && ((Roles & role) != role))
return false;
Can anyone provide me some knowledge of this implementation?
Thank you very much.
Daoming