Created
April 12, 2018 09:09
-
-
Save PrateekKumarSingh/7c2ab9b177255bcad038242562d7423f to your computer and use it in GitHub Desktop.
This file contains hidden or 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