title: Faster way to do a List<T>.Contains()
body: <p>I am trying to do what I think is a "de-intersect" (I'm not sure what the proper name is, but that's what Tim Sweeney of EpicGames called it in the old UnrealEd)</p>
  
  <pre><code>// foo and bar have some identical elements (given a case-insensitive match)
  List‹string› foo = GetFoo();
  List‹string› bar = GetBar();
  
  // remove non matches
  foo = foo.Where(x =&gt; bar.Contains(x, StringComparer.InvariantCultureIgnoreCase)).ToList();
  bar = bar.Where(x =&gt; foo.Contains(x, StringComparer.InvariantCultureIgnoreCase)).ToList();
  </code></pre>
  
  <p>Then later on, I do another thing where I subtract the result from the original, to see which elements I removed. That's super-fast using .Except(), so no troubles there.</p>
  
  <p>There must be a faster way to do this, because this one is pretty bad-performing with ~30,000 elements (of string) in either List. Preferably, a method to do this step and the one later on in one fell swoop would be nice. I tried using .Exists() instead of .Contains(), but it's slightly slower. I feel a bit thick, but I think it should be possible with some combination of .Except() and .Intersect() and/or .Union().</p>