Last active
October 4, 2019 23:41
PowerShell example using an enumerator type to map colour name to value
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
$colourName = 'green' | |
# Only needs to be declared once | |
enum colour { | |
red = 0xFF0000 | |
green = 0x00FF00 | |
blue = 0x0000FF | |
white = 0xFFFFFF | |
} | |
return ([colour] $colourName).value__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment