I’m trying to do the equivelent of a SQL MINUS on two string arrays. Here’s the code that I’m trying to replicate:
string returnValue = "";
foreach (string eachWord in allWords)
{
foreach (string ignoreWord in ignoreWords)
{
if (eachWord != ignoreWord)
{
returnValue += eachWord;
}
}
}
I want to rewrite this as:
returnValue = allWords.Minus(ignoreWords);
or something equally succinct. I realize that behind the scenes I’ll end up with the same code, but I’m just being pedantic !
1 Answer