The idea of Enum Flags is to take an enumeration variable and allow it hold multiple values. It should be used whenever the enum represents a collection of flags, rather than representing a single value.You create a bit flags enum by applying the System.
Question:How to check if the flags enum value has/contains other flags enum values in c#?
Description:For example I have Following flags enum and I have stored a number 7 in the database now I have to check if 7 contains the requested number let say 3(which is for OptionOne and OptionTwo) it should return true, in this way I have to compare a single int value with a single int value for the following flag enum. [Flags] public enum MyFlagsEnum { None = 0, OptionOne = 1, OptionTwo = 2, OptionThree = 4, }
Posted by: Junaid Aziz | Posted on: Aug 21, 2020