-
-
Save stephensmitchell/5a9a7bd98d530a0fc1c4bfa78705d34d to your computer and use it in GitHub Desktop.
LINQPad snippet that declares two string arrays, spits out their mutually exclusive parts. #LINQPad
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
var set1 = new string[]{"a","b","c","d"}; | |
var set2 = new string[]{"a","e","i","o","u"}; | |
var q = set1.Except(set2); | |
Console.WriteLine(q.Count()); | |
Console.WriteLine(""); | |
foreach(string s in q) | |
{ | |
Console.WriteLine(s); | |
} | |
Console.WriteLine(""); | |
var r = set2.Except(set1); | |
Console.WriteLine(r.Count()); | |
Console.WriteLine(""); | |
foreach(string s in r) | |
{ | |
Console.WriteLine(s); | |
} | |
Console.WriteLine(""); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment