Mega Code Archive

 
Categories / VB.Net / Data Types
 

Enum GetNames Method retrieves an array of the names of the constants in a specified enumeration

Imports System Public Class GetNamesTest     Enum Colors         Red         Green         Blue         Yellow     End Enum 'Colors     Enum Styles         Plaid         Striped         Tartan         Corduroy     End Enum 'Styles     Public Shared Sub Main()         Dim s As String         For Each s In  [Enum].GetNames(GetType(Colors))             Console.WriteLine(s)         Next s         For Each s In  [Enum].GetNames(GetType(Styles))             Console.WriteLine(s)         Next s     End Sub End Class