It might seem that you want Enum with the [Flags] attribute. You would have:
[Flags]
enum ThingType
{
THING1 = 1,
THING2 = 2,
THING2 = 4,
THING3 = 8,
THING4 = 16
}
This allows you to do something like
ThingType x = ThingType.THING1 | ThingType.THING3;
And
int x = 3;
ThingType y = (ThingType)x;
source
share