I want to compare two lists and get the valid words into a new list.
var words = new List(); var badWords = new List(); //this i
Use EnumerableExcept function storing in System.Linq namespace
Enumerable
System.Linq
finalList = words.Except(badWords).ToList();
Most efficient way to save your time and also the fastest way to do it, because Except implementation uses Set, which is fast
Except
Set