I want to compare two lists and get valid words in a new list.
var words = new List<string>();
var badWords = new List<string>();
words.Add("Apple");
words.Add("Moron");
words.Add("Seafood");
words.Add("Cars");
words.Add("Chicken");
words.Add("Twat");
words.Add("Watch");
words.Add("Android");
words.Add("c-sharp");
words.Add("Fool");
badWords.Add("Idiot");
badWords.Add("Retarded");
badWords.Add("Twat");
badWords.Add("Fool");
badWords.Add("Moron");
I am looking for the most effective way to compare lists and put all the “good” words in a new list. The resulting list should not contain Moron, Tweet, and Fool.
var finalList = new List<string>();
Or is there no need to create a new list? I am glad to hear your ideas!
Thank you in advance
source
share