Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PlagueHO/b5f50f639ca3cf6c3d7f8f5a21a1cfbb to your computer and use it in GitHub Desktop.
Save PlagueHO/b5f50f639ca3cf6c3d7f8f5a21a1cfbb to your computer and use it in GitHub Desktop.
PowerShell example using a hash table in a PSD1 and null coalescing to map colour name to value
$colourName = 'green'
$colourMap = Import-LocalizedData -FileName mapping.psd1
$colourValue = ($colourMap[$colourName], 0x0, 1 -ne $null)[0] # Null Coalescing
return $colourValue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment