Last active
October 21, 2016 14:21
-
-
Save feliperomero3/efbabc4c949f5f934f33699596f7dc82 to your computer and use it in GitHub Desktop.
How to use Enums in VB.Net
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System | |
Public Enum flavorEnum | |
salty | |
sweet | |
sour | |
bitter | |
End Enum | |
Public Module Module1 | |
Public Sub Main() | |
Dim isEqual As Boolean = False | |
Dim flavors As String() = {"salty","sweet","sour","bitter"} | |
Dim index As Integer | |
Console.WriteLine("The strings in the flavorEnum are:") | |
Dim i As String | |
For Each i In [Enum].GetNames(GetType(flavorEnum)) | |
Console.WriteLine(String.Format("{0} equals {1}: {2}", i, flavors(index), i = flavors(index))) | |
'Console.WriteLine(i) | |
index = index + 1 | |
Next | |
End Sub | |
End Module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment