日期:2014-05-19  浏览次数:21450 次

给枚举成员加的自定义特性,怎么在程序中提取?
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
------解决方案---------
友情链接: 爱易网 云虚拟主机技术 云服务器技术 程序设计技术 开发网站 APP开发教程
Copyright © 2013-2026 爱易网页 当前在线:1012人  网站在17时29分7秒内访问总人数:207875人 2秒前 52.36%  粤ICP备18100884号-2