title: Why does my value get cascaded into every other index in my list?
body: <p>Got another C# question I'm not too sure about.  I know where the problem is occurring but don't understand why it would be happening.</p>
  
  <p>I'm using the List.Add(); Method to add an int[] when certain conditions are met.  What I found is that when the loop finishes and I supposedly have all the values contained, all the values are the same across every index.</p>
  
  <p>During debugging I found that it adds the first one correctly, but then when the second gets added it overwrites the first BUT also adds a second.  I've never seen this happen with List.Add() before, but maybe it's because I'm storing int[] objects this time?</p>
  
  <p>Here's the code that adds it all in.  Looks harmless to me, but this is perhaps where I'm lacking knowledge:</p>
  
  <pre><code>NumbersForTriples[0] = (int)Math.Sqrt(a);
  NumbersForTriples[1] = (int)Math.Sqrt(b);
  NumbersForTriples[2] = (int)Math.Sqrt(c);
  Triples.Add(NumbersForTriples);
  </code></pre>