How to list Enum\'s members in code? I have the following Enum:
Public Enum TestEnum As int32
First = 0
Second = 2
Third = 4
Fourth = 6
End Enum
You can simply iterate through all values like this:
Public Enum TestEnum As int32
First = 0
Second = 2
Third = 4
Fourth = 6
End Enum
For Each tstEnum As TestEnum In System.Enum.GetValues(GetType(TestEnum))
Response.Write(
String.Format("Name: {0} Value: {1}",
tstEnum.ToString,
CInt(tstEnum).ToString
)
)
Next