Given the following enum:
Public Enum MyEnum
<Description("F irst Item")> _
FirstItem
<Description("S econd Item")> _
SecondItem
<Description("T hird Item")> _
ThirdItem
End Enum
If I have a variable of type MyEnum, how can I extract the value of
the Description attribute (which is of type DescriptionAttr ibute)?
Dim e As MyEnum = MyEnum.SecondIt em
How can I get the value of the Description attribute (which is "Second
Item")? Note that I do not want the enum name ("SecondItem "), I want
the value of the attribute.
I have tried the GetCustomAttrib utes member of System.Type, but that
does not seem to work.
Any hints??
Thanks
Public Enum MyEnum
<Description("F irst Item")> _
FirstItem
<Description("S econd Item")> _
SecondItem
<Description("T hird Item")> _
ThirdItem
End Enum
If I have a variable of type MyEnum, how can I extract the value of
the Description attribute (which is of type DescriptionAttr ibute)?
Dim e As MyEnum = MyEnum.SecondIt em
How can I get the value of the Description attribute (which is "Second
Item")? Note that I do not want the enum name ("SecondItem "), I want
the value of the attribute.
I have tried the GetCustomAttrib utes member of System.Type, but that
does not seem to work.
Any hints??
Thanks
Comment