Skip to content

Instantly share code, notes, and snippets.

@iainbrighton
Last active May 10, 2017 08:33
Show Gist options
  • Save iainbrighton/f827c77e80459a438efe8bebae6448ed to your computer and use it in GitHub Desktop.
Save iainbrighton/f827c77e80459a438efe8bebae6448ed to your computer and use it in GitHub Desktop.
<#
## String comparison that will return the incorrect result
'1.9' -gt '1.10'
True
## Casting to [System.Version] compares successfully
[version]'1.9' -gt [version]'1.10'
False
## You can also do this - The type on the right is coerced into the same type on the left side of the operator
[version]'1.9' -gt '1.10'
False
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment