Define String ENUM in VB.Net

后端 未结 6 1610
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-09 15:37

I am using Window Application for my project. There is situation where i need to define string enum and using it in my project.

i.e.

Dim PersonalInfo         


        
6条回答
  •  渐次进展
    2020-12-09 16:03

    How can i get this value using ENUM? or anyother way to do it.

    There are three common ways of mapping enum values to strings:

    • Use a Dictionary(Of YourEnumType, String)
    • Decorate the enum values with attributes (e.g. DescriptionAttribute) and fetch them with reflection
    • Use a Switch statement

    The first of these options is probably the simplest, in my view.

提交回复
热议问题