What is the best way to combine an enum with a string value
Below are 2 functions that I have associated with an enum and it's value. What is the best way to combine these items into one object type to give me the following functionality. I basically want to be able to pass an enum value as parameters but parse and output the Textual description of the enum.
I'm open to suggestions on the best way to handle this. I have about 20 different enums and want to have each enum's functions contained.
' Looking for behavior similar to this
Dim x as GenderType ' No instantiation necessary
x = Gender.Male ' setting takes a enum value
x.ToString() ' to string returns a string value of the current enum
x.Parse("Male") ' sets x to Gender.Male
Public enum Gender
NotSpecified = 0
Male = 1
Female = 2
Public Function ToString_Gender(ByVal val as Gender) as String
select case val
return "Not Specified"
Public Function Parse_Gender(ByVal text as string) as Gender
select case "Not Specified"
select case "Male"
select case "Female"