zkeown
asked on
Alternative to Enum for object oriented key/value pairs?
For the same of code readability, I've created an Enum for Cycle Type:
Public Enum CycleType
Unknown = 0
Full = 1
Partial = 2
End Enum
However, I just got a new requirement that these be configurable via a database -- in other words there will be a table with cycle type ID and description. Is there a way to populate a [something] from a database while retaining the code readability of an Enum.
Public Enum CycleType
Unknown = 0
Full = 1
Partial = 2
End Enum
However, I just got a new requirement that these be configurable via a database -- in other words there will be a table with cycle type ID and description. Is there a way to populate a [something] from a database while retaining the code readability of an Enum.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I am sorry, I thought that you were saying the values could be different based on database (dynamic). If they are static, I would agree.
Additionally, you can use a class with Public Shared members/properties if that is the case also.
Additionally, you can use a class with Public Shared members/properties if that is the case also.
Note that I changed the Names slightly because VB.Net 2005 Express didn't like "Partial" as a name since it is a reserved keyword...
Open in new window