title: C# Linq Comparing List Values using multiple fields and return item which doesn't satisfy the condition
body: <p>I have a List like this called <strong>result</strong></p>
  <pre><code>{ Id = &quot;8131367&quot;, GId = 27720, Share = 1.0000, Type = &quot;1029&quot;, OPC = &quot;997&quot;, IPC = &quot;997&quot;, Price = 500.00 }
  { Id = &quot;8131368&quot;, GId = 27720, Share = 1.0000, Type = &quot;1029&quot;, OPC = &quot;997&quot;, IPC = &quot;997&quot;, Price = 1500.00 }
  { Id = &quot;8131369&quot;, GId = 27720, Share = 1.0000, Type = &quot;1029&quot;, OPC = &quot;997&quot;, IPC = &quot;997&quot;, Price = 500.00 }
  { Id = &quot;8131370&quot;, GId = 27720, Share = 1.0000, Type = &quot;1029&quot;, OPC = &quot;997&quot;, IPC = &quot;997&quot;, Price = 500.00 }
  { Id = &quot;8131371&quot;, GId = 27720, Share = 1.0000, Type = &quot;1029&quot;, OPC = &quot;997&quot;, IPC = &quot;997&quot;, Price = 500.00 }
  { Id = &quot;8131372&quot;, GId = 27720, Share = 1.0000, Type = &quot;1029&quot;, OPC = &quot;997&quot;, IPC = &quot;997&quot;, Price = 500.00 }
  { Id = &quot;8131373&quot;, GId = 27721, Share = 1.0000, Type = &quot;1029&quot;, OPC = &quot;997&quot;, IPC = &quot;997&quot;, Price = 500.00 }
  { Id = &quot;8131374&quot;, GId = 27721, Share = 1.0000, Type = &quot;1029&quot;, OPC = &quot;997&quot;, IPC = &quot;997&quot;, Price = 500.00 }
  { Id = &quot;8131375&quot;, GId = 27721, Share = 1.0000, Type = &quot;1029&quot;, OPC = &quot;997&quot;, IPC = &quot;997&quot;, Price = 500.00 }
  { Id = &quot;8131376&quot;, GId = 27721, Share = 1.0000, Type = &quot;1029&quot;, OPC = &quot;997&quot;, IPC = &quot;997&quot;, Price = 500.00 }
  { Id = &quot;8131377&quot;, GId = 27721, Share = 1.0000, Type = &quot;1029&quot;, OPC = &quot;997&quot;, IPC = &quot;997&quot;, Price = 1500.00 }
  </code></pre>
  <p>I need to filter the list based on GId,Share, Type, OPC, IPC having same values and Price having Different value. So from the list the second and the last one having a Price Different So I need to get that list or Id Property from the List Item which have price different and rest of the values same.</p>
  <p>By Using Two Foreach loops I was able to get what i needed but unfortunately I was asked to convert it into a LINQ query. this is what I tried</p>
  <pre><code>var items = result.Select(r =&gt; result.Where(rr =&gt; (r.GId == rr.GId) 
                                                     &amp;&amp; (r.Share == rr.Share) 
                                                     &amp;&amp; (r.Type == rr.Type) 
                                                     &amp;&amp; (r.IPC == rr.IPC) 
                                                     &amp;&amp; (r.OPC == rr.OPC) 
                                                     &amp;&amp; (r.Price != rr.Price))).ToList();
  </code></pre>
  <p>But from the query above I am not getting what I wanted, I believe I am near to what I needed but I lack the expertise with LINQ.</p>