I\'d like one general purpose function that could be used with any Flags style enum to see if a flag exists.
This doesn\'t compile, but if anyone has a suggestion, I
Well, I don't believe there is a way to do this, as there are no constraints that apply to bitwise operators.
However... you can just cast your enum to int and do it.
public static Boolean IsEnumFlagPresent(int value,int lookingForFlag)
{
return ((value & lookingForFlag) == lookingForFlag);
}
This works, but may be confusing to someone.