Comparing two lists with multiple conditions
<p>I have two different lists of same type. I wanted to compare both lists and need to get the values which are not matched.
List of class:</p>

<pre><code>public class pre
{
public int id {get; set;}
public datetime date {get; set;}
public int sID {get; set;}
}
</code></pre>

<p>Two lists :</p>

<pre><code>List&lt;pre&gt; pre1 = new List&lt;pre&gt;();
List&lt;pre&gt; pre2 = new List&lt;pre&gt;();
</code></pre>

<p>Query which I wrote to get the unmatched values:</p>

<pre><code>var preResult = pre1.where(p1 =&gt; !pre
                    .any(p2 =&gt; p2.id == p1.id &amp;&amp; p2.date == p1.date &amp;&amp; p2.sID == p1sID));
</code></pre>

<p>But the result is wrong here. I am getting all the values in pre1.</p>