There are a lot of enumerations in the application I'm working on.
These values ββare usually selected from the application drop-down lists.
What is the common way to store a string description of these values?
Here is the current problem:
Public Enum MyEnum SomeValue = 1 AnotherValue = 2 ObsoleteValue = 3 YetAnotherValue = 4 End Enum
The drop-down list should contain the following parameters:
Some Value Another Value Yet Another Value (Minor Description)
Not all correspond to the name of the enumeration (a brief description on one example), and not all enumeration values ββare -current values. Some of them remain only for backward compatibility and display (for example, printouts, not forms).
This leads to the following code situation:
For index As Integer = 0 To StatusDescriptions.GetUpperBound(0) ' Only display relevant statuses. If Array.IndexOf(CurrentStatuses, index) >= 0 Then .Items.Add(New ExtendedListViewItem(StatusDescriptions(index), index)) End If Next
It seems that this can be done better, and I'm not sure how to do it.
source share