I have a base class which needs to define an enumeration:
BaseClass
– SomeEnum
I then need to create two derived classes from the base class and extend the values in the enumeration:
ChildClass1 : BaseClass
– SomeEnum
– SomeEnumValue1
ChildClass2 : BaseClass
– SomeEnum
– SomeEnumValue2
In C# or VB.NET can someone provide the syntax to do this? Or if not possible suggest an alternative to what I’m trying to do? Thanks!
Extending the list of values in an enumeration is not possible. Enumerations are static at their point of declaration and compilation.
Your alternative is to stop using enumerations and replace it with some other datatype or class hierarchy.