Enumerator


An Enum is a value type with a set of related named constants often referred to as an enumerator list. The Enum keyword is used to declare an enumeration. It is a primitive data type, which is user defined.


Syntax of declaring an enumeration


Enum Days

Sun = 1

Mon

Tue

Wed

End Enum


For example: Code define the Enumerator


Module Module1

Enum Days As Byte

Sun = 1

Mon

Tue

Wed

End Enum

Class EnumTest

Public Shared Sub Main()

Dim d As Days = Days.Tue

Console.WriteLine(d)

Console.WriteLine(CInt(d))

End Sub

End Class

End Module


I hope this blog will help you.