Mega Code Archive

 
Categories / VB.Net / Data Types
 

Enum GetValues Method retrieves an array of the values of the constants in a specified enumeration

Public Class GetValuesTest     Enum Colors         Red         Green         Blue         Yellow     End Enum 'Colors     Enum Styles         Plaid = 0         Striped = 23         Tartan = 65         Corduroy = 78     End Enum      Public Shared Sub Main()         Dim i As Integer         For Each i In  [Enum].GetValues(GetType(Colors))             Console.WriteLine(i)         Next         For Each i In  [Enum].GetValues(GetType(Styles))             Console.WriteLine(i)         Next     End Sub  End Class