给枚举成员加的自定义特性,怎么在程序中提取?
Public Class dongwu
Public Sub M_得到枚举的自己定义的特性()
Dim ii As Animal1
Dim name As String
ii = Animal1.Dog
' 本人的问题是如何通过 ii 让 name = 狗
End Sub
Public Enum Animal1
<EnumNote( "狗 ")> _
Dog = 1
<EnumNote( "猫 ")> _
Cat = 2
<EnumNote( "鸟 ")> _
Bird = 3
End Enum
End Class
<AttributeUsage(AttributeTargets.All)> Public Class EnumNote
Inherits System.Attribute
Private f_note As String
Public Property P_Note() As String
Get
Return f_note
End Get
Set(ByVal Value As String)
f_note = Value
End Set
End Property
Public Sub New(ByVal x_node As String)
f_note = x_node
End Sub
End Class
------解决方案--------------------接分接分~~ 我要接分~
------解决方案--------------------哦~jf
------解决方案---------