I know this rather goes against the idea of enums, but is it possible to extend enums in C#/Java? I mean \"extend\" in both the sense of adding new values to an enum, but a
A temporary/local workaround, when you just want very local/one time usage:
enum Animals { Dog, Cat } enum AnimalsExt { Dog = Animals.Dog, Cat= Animals.Cat, MyOther} // BUT CAST THEM when using: var xyz = AnimalsExt.Cat; MethodThatNeedsAnimal( (Animals)xyz );
See all answers at: Enum "Inheritance"