Last active
November 22, 2021 06:22
-
-
Save arphox/d43d7a1a309f36f65bad2f8c73d9f5c9 to your computer and use it in GitHub Desktop.
Enum.HasFlag implementation
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
[System.Security.SecuritySafeCritical] | |
public Boolean HasFlag(Enum flag) { | |
if (flag == null) | |
throw new ArgumentNullException("flag"); | |
Contract.EndContractBlock(); | |
if (!this.GetType().IsEquivalentTo(flag.GetType())) { | |
throw new ArgumentException(Environment.GetResourceString("Argument_EnumTypeDoesNotMatch", flag.GetType(), this.GetType())); | |
} | |
return InternalHasFlag(flag); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shared on Medium, don't delete!