Posted By

dimitrisdapontes on 01/26/13


Tagged

enum description


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

kekeben


Enum Description


 / Published in: VB.NET
 

Returns the description set in an enum value, or if no description is found it returns the name of the enum value. Use this without worrying about passing the enum type, you should only pass the enum value

Example

Friend Enum Duration
    <Description("Every 12 Months")> Year = 1
    <Description("Every 6 Months")> Semester = 2
End Enum

GetEnumDescription(Duration.Year) returns "Every 12 Months"

Report this snippet  

You need to login to post a comment.