I need to detect if a flag is set within an enum value, which type is marked with the Flag attribute.
Usually it is made like that:
(value & flag) ==
I have used this to compare flags
public static bool IsSet(this T input, T match) { return (Convert.ToUInt32(input) & Convert.ToUInt32(match)) != 0; }
Here you can do the different conversions. From int to short to long.