I have a collection of an object called dictionaryWords.
For each word in this collection I need to check if it does not contain certain letters. If it does contain one or more of a certain letter it is removed from the collection.
Example:
Collection before removal: ['abc','dee',fff']
letters to check for: e,f
Collection after removal: ['abc']
Rather than specifying multiple letters is there a way to check against an array?
My code:
foreach(DictionaryWord word in dictionaryWords)
{
if (!word.Contains("D") && !word.Contains("E") // optimize this line
{
// Word does not contain letters, word is good
}
}
How can I replace the "optimize this line" to say "if word contains any letter from an array of values"
Thanks, Andrew