If you have an enumeration data that you need to list it out for selection, for example in ListBox control, you can use static methods provided in Enum class, e.g. GetNames and GetValues methods.
The static Enum.GetNames method will return an array of string of the enumeration value in textual format, as for Enum.GetValues will return an array of integer of the enumeration value. Read the rest of this entry »
Popularity: 2% [?]
When a numeric value is passed to a method that accepts an enumeration type, it is possible that the numeric value does not exist in the parameter that accepts the enumeration value. You want to perform a test before using this numeric value to determine whether it is indeed listed in this enumeration type. Read the rest of this entry »
Popularity: 2% [?]
Internally the enumeration value is assigned as integer, but ToString method to display an enumeration value in textual or numeric value. The method can accept a character to indicate the type of formatting to place on the enumeration value. The table below shows the available type of formatting. Read the rest of this entry »
Popularity: 100% [?]
When you have a plain text that possibly read from a text file or configuration in database for specific enumeration, you can convert this textual value back to its enumeration type. This can be done with the static method Parse on the Enum class. Read the rest of this entry »
Popularity: 2% [?]
Enumerations implicitly inherit from System.Enum, which, in turn, inherits from System.ValueType. Enumerations have a single use: to describe items of a specific group. For example, the traffic light colors red, yellow, and green could be defined by the enumeration TrafficLight; likewise Low, Medium, and High could be defined by the enumeration RiskLevel. These enumerations would look like the following: Read the rest of this entry »
Popularity: 3% [?]