I have the following set of enums:
[Flags]
public enum Categories : uint
{
A = (1 << 0),
B = (1 << 1),
B1 = B | (1 << 16),
B2 = B | (1 << 17),
B3 = B | (1 << 18),
B4 = B | (1 << 19),
B5 = B | (1 << 20),
C = (1 << 2),
C1 = C | (1 << 21),
D = (1 << 3),
D1 = D | (1 << 22),
D2 = D | (1 << 23),
E = (1 << 4),
F = (1 << 5),
F1 = F | (1 << 23),
F2 = F | (1 << 24),
F3 = F | (1 << 25),
F4 = F | (1 << 26),
F5 = F | (1 << 27),
G = (1 << 6),
H = (1 << 7),
H1 = H | (1 << 28),
}
The idea is that the enums represent a hierarchical structure where a child enum implies its parent and any number of flags can be applied.
The problem I am seeing is that all child enums are not being represented during debugging as names or sets of names. I.E., Categories.F
= "F" but Categories.F2
= 16777248. I would have hoped Categories.F2
= "F, F2" or at least "F2"
How can I make my enums remain recognized as flags? Is there a better way to accomplish what I'm trying to do?