I\'ve got an Enum marked with the [Flags] attribute as follows:
[Flags]
public enum Tag : int
{
None = 0,
PrimaryNav = 1,
HideChildPages = 2,
You could use Jon Skeet's Unconstrained Melody library:
var someEnumValue = Tag.PrimaryNav | Tag.HideChildPages;
someEnumValue.HasAny(Tag.PrimaryNav | Tag.HomePage); // Returns true
var tag = Tag.HideChildPages | Tag.PrimaryNav;
If ((tag & Tag.PrimaryNav) == Tag.PrimaryNav) {
// Tag.PrimaryNav set.
}