|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Get all members of an EnumI can't remember what is the namespace/class that can be used to retrieve
all the members of an enum Thank you, Samuel Samuel Shulman wrote:
> I can't remember what is the namespace/class that can be used to retrieve System.Enum> all the members of an enum Option Explicit On Option Strict On Imports System Module Module1 Private Enum TestEnum one = 1 two three four End Enum Sub Main() Dim names As String() = [Enum].GetNames(GetType(TestEnum)) For Each valueName As String In names Console.WriteLine("{0} = {1}", valueName, DirectCast([Enum].Parse(GetType(TestEnum), valueName), Integer)) Next End Sub End Module HTH, -- Tom Shelton [MVP] |
|||||||||||||||||||||||