-
-
Save johndonnelly/0cbd22c8fce88027b5c97b3a0f467fea to your computer and use it in GitHub Desktop.
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
# define a set | |
$x = [System.Collections.Generic.HashSet[string]]::new() | |
'python'.ToCharArray().foreach({[void]$x.add($_)}) | |
$y = [System.Collections.Generic.HashSet[string]]::new() | |
'powershell'.ToCharArray().foreach({[void$y.add($_)}) | |
$x.ExceptWith($y) # All the elements in x but not in y | |
# union | |
$x.UnionWith($y) # Unique elements in x or y or both | |
# intersection | |
$x.IntersectWith($y) # Elements in both x and y | |
$x.SymmetricExceptWith($y) # Elements in x or y but not in both |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment