If I defined a ENUM in a base object with several default values. When I inherit from the base object I want to add more options the the ENUM list which are specific to the inheriting object.
For example my base could have a ENUM called Direction with values:
None
ALL
Stop
Start
I create a new class call Compass which inherits the base class and what to add the following to the ENUM Direction.
North
South
East
West
I create a new class call Navigation which inherits the base class and what to add the following to the ENUM Direction.
Left
Right
So, In my inheriting class haow do I extend the ENUM.
I am using VB.NET.
You can’t do that since enums are value types and so are sealed.
Though he’s a codeproject article that tries to work around that: http://www.codeproject.com/KB/cs/EnumBuilder.aspx