Created
December 28, 2021 09:28
-
-
Save SBajonczak/827ce5914477b6063e9b8465a1cc891a to your computer and use it in GitHub Desktop.
Generate Bitmask Check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public bool HasAccessTo(int profileValue, ApplicationRole roleToCheck){ | |
return (profileValue & roleToCheck) === roleToCheck | |
} | |
// Will result true | |
bool result= HasAccesTo(21,ApplicationRole.Contributor); | |
// Will result false | |
bool result= HasAccesTo(21,ApplicationRole.Administrator); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment