Hi guys, How can I parse a string in VB.NET to enum value?
Example I have this enum:
Public Enum Gender
NotDefined
Male
Female
End Enum
how can I convert a string "Male" to the Gender
enum's Male
value?
Hi guys, How can I parse a string in VB.NET to enum value?
Example I have this enum:
Public Enum Gender
NotDefined
Male
Female
End Enum
how can I convert a string "Male" to the Gender
enum's Male
value?
Dim val = DirectCast([Enum].Parse(GetType(Gender), "Male"), Gender)