title: linq Any operator with not equal(!=)
body: <p>I'm having trouble understanding the linq any operator. Lets consider the following snippet of code (using VS 2010 and .Net 4.0)</p>
  
  <pre><code>List&lt;string&gt; sample = new List&lt;string&gt; { "a", "b", "c", "d" };
  List&lt;string&gt; secondSample = new List&lt;string&gt; {  "b", "c" };
  
  foreach (string s in sample)
  {
      if(secondSample.Any(data=&gt; data.ToString() == s))
          Console.WriteLine(s);
  }
  </code></pre>
  
  <p>When run it produces the following output </p>
  
  <pre><code>b
  c
  </code></pre>
  
  <p>Which is what I'm expecting. However if I change the equality operator(<code>==</code>) to Not Equal(<code>!=</code>) I get this</p>
  
  <pre><code>a
  b
  c
  d
  </code></pre>
  
  <p>Shouldn't this be</p>
  
  <pre><code>a
  d
  </code></pre>
  
  <p>if I change the if condition to</p>
  
  <pre><code>if(!(secondSample.Any(data=&gt; data.ToString() == s)))
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>a
  d
  </code></pre>
  
  <p>So my question is am I interpreting the the Any operator in the wrong way? Shouldn't </p>
  
  <pre><code>if(secondSample.Any(data=&gt; data.ToString() != s))
  </code></pre>
  
  <p>evaluate to true when values from <code>secondSample</code> is not in sample</p>