Public Enum Pet
None = 0
Dog = 1
Cat = 2
Bird = 4
Rabbit = 8
Other = 16
End Enum
Module Example
Public Sub Main()
Dim petsInFamilies() As Pet = { Pet.None, Pet.Dog Or Pet.Cat, Pet.Dog }
Dim familiesWithoutPets As Integer
Dim familiesWithDog As Integer
For Each petsInFamily In petsInFamilies
If petsInFamily.Equals(Pet.None) Then
familiesWithoutPets += 1
Else If petsInFamily.HasFlag(Pet.Dog) Then
familiesWithDog += 1
End If
Next
Console.WriteLine(familiesWithoutPets)
Console.WriteLine(familiesWithDog)
End Sub
End Module