Last active
March 10, 2019 12:18
-
-
Save ezhov-da/1370d903c4327514ede97429a3f27836 to your computer and use it in GitHub Desktop.
vba оператор enum
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
'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