可以说我有以下枚举:
[Flags]
public enum NotifyType
{
None = 0,
Window = 1 << 0,
Sound = 1 << 1,
Flash = 1 << 2,
MobileSound = 1 << 3,
MobilePush = 1 << 4
}
考虑两个枚举:
var myenums = Window | Sound | Flash;
//var possibleUpdate = Window | MobilePush;
void UpdateMyEnums(NotifyType possibleUpdate)
{
//Does myenums contain all the flags in 'possibleUpdate'? If not add
//the missing flags to myenums
}
与 相比,如何确定myenums
变量不包含该NotifyType.MobilePush
值possibleUpdate
?我必须针对每个标志进行测试possibleUpdate
吗myenums
?
我在 .NET 4.0 上使用 C#