enum
used for permissions is missing the Flags
attribute CS-A1004Flags
attribute is generally used when representing multiple values often via bitwise operators. It is recommended that enum
s used in implementing permissions use this attribute.
enum MyEnum
{
None = 0,
First = 1 << 0,
Second = 1 << 1,
Third = 1 << 2,
Fourth = 1 << 3
}
[Flags]
enum MyEnum
{
None = 0,
First = 1 << 0,
Second = 1 << 1,
Third = 1 << 2,
Fourth = 1 << 3
/* `One` and `Four` can now be represented as `MyEnum.One | MyEnum.Four` (using the `|` bitwise operator) */
}