title: Minimum reprocessing when comparing 2 identical list in c#
body: <p>I've got two identical lists I need to compare so I thought I'd create a 2 dimensional array and store a bool value as to whether my condition passed or failed but I want to reduce the number of checks made against each element as it wouldn't make sense to:</p>
  
  <pre><code>a) compare the exact same elements (as this condition would always pass 
     in my scenario).
  
     |0|1|2|
  ----------
   |0|x| | |
   |1| |x| |
   |2| | |x|
  ----------
  
  b) compare exact opposite elements in the array where if a condition
     passed where i=1 and j=2 we'd know that i=2 and j=1 would also pass.
  
     Array1: [2,6,9]
     Array2: [2,6,9]
  
     |0|1|2|
  ----------
   |0| | | |
   |1| | |p|
   |2| |p| |
  ----------
  
   Where p[2,1] would be (9,6) for example and p[1,2] would be (6,9) which
   in my case would mean they are identical. 
  </code></pre>
  
  <p>So based on the above is there a way to minimize the looping required or do I have to loop using something similar to this?</p>
  
  <pre><code>for (int i = 0; i &lt; source.Count; i++)
  {
      for (int j = 0; j &lt; compare.Count; j++)
  {
      if ((i != j) &amp;&amp; 
              !alreadyProcessed[i, j] &amp;&amp; !alreadyProcessed[j, i])
      {
              alreadyProcessed[i, j] = true;
              alreadyProcessed[j, i] = true;
              bool condition = ...;
              if (condition)
              {
      }
          }
      else
          {
              if (i == j)
              {
          alreadyProcessed[i, j] = true;
          }
      }
      }
  }
  </code></pre>
  
  <p>I was hoping that using linq and intersection for example that I could exclude the likes of (0,0), (1,1) and (2,2) for example and then somehow have a single combination of unique combinations as we would only need (0,1) and (0,2) and (1,2) as we'd know that (1,0), (2,0) and (2,1) would be the same as their opposite.</p>
  
  <p>Hope it makes sense.</p>