In writing a class recently, I came upon the need to grab the name of a given enum passed in as a parameter.
Enum StatusFlags
Active = 1
Pending = 2
Closed = 3
End Enum
It's actually very simple to retrieve the name corresponding to my Enumerable value by just adding a .ToString to the end of it.
Public Function GetStatusName(ByVal flag As StatusFlags) As String
Return flag.ToString
End Property
Posted Thursday, February 09, 2012