A lot of people don’t realise that there is actually an Enum class in .NET that you can use to perform a few nice tricks. In order to access the shared methods in it in VB.NET, you need to enclose it in square brackets. The following functions I find particularly useful: -
- [Enum].GetName
- [Enum].GetNames
- [Enum].GetValues
These are all useful ways that you can access the values and corresponding strings that are in Enums. In case you aren’t familiar with it, you’ll usually need to use GetType to pass in the type of the enum eg. [Enum].GetName(GetType(System.DayOfWeek),1) will return “Monday”.
No related posts.
Tags: .NET, .NET Framework, Solutions











