Skip to content

Instantly share code, notes, and snippets.

@ezhov-da
Last active March 10, 2019 12:18
Show Gist options
  • Save ezhov-da/1370d903c4327514ede97429a3f27836 to your computer and use it in GitHub Desktop.
Save ezhov-da/1370d903c4327514ede97429a3f27836 to your computer and use it in GitHub Desktop.
vba оператор enum
'https://msdn.microsoft.com/ru-ru/library/8h84wky1.aspx
Public Class Egg
Enum EggSizeEnum
Jumbo
ExtraLarge
Large
Medium
Small
End Enum
Public Sub Poach()
Dim size As EggSizeEnum
size = EggSizeEnum.Medium
' Continue processing...
End Sub
End Class
Public Sub Scramble(ByVal size As Egg.EggSizeEnum)
' Process for the three largest sizes.
' Throw an exception for any other size.
Select Case size
Case Egg.EggSizeEnum.Jumbo
' Process.
Case Egg.EggSizeEnum.ExtraLarge
' Process.
Case Egg.EggSizeEnum.Large
' Process.
Case Else
Throw New ApplicationException("size is invalid: " & size.ToString)
End Select
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment