title: List.Add seems to be duplicating entries. What's wrong?
body: <p>I have a class like this:</p>
  
  <pre><code>public class myClass
  {
    public List&lt;myOtherClass&gt; anewlist = new List&lt;myOtherClass&gt;;
  
    public void addToList(myOtherClass tmp)
    {
      anewList.Add(tmp);
    }
  
  }
  </code></pre>
  
  <p>So I call "addToList" a hundred times, each adding a unique item to the list.  I've tested my items to show that before I run the "addToList" method, they are unique.  I even put a line in to test "tmp" to make sure it was what I was expecting.</p>
  
  <p>However, when I do this (lets say myClass object is called tmpClass):</p>
  
  <pre><code>int i = tmpClass.anewList.Count();
  for (int j = 0; j&lt;i; j++)
  {
     //write out each member of the list based on index j...
  }
  </code></pre>
  
  <p>I get the same exact item, and it's the last one that was written into my list.  It's as if when I add, I'm overwriting the entire list with the last item I've added.  </p>
  
  <p>Help?  This makes no sense.
  I've also tried List.Insert, where I'm always inserting at the end or at index 0.  Still no dice.  Yes, I'm doubly source my indexing is correct and when I do my test I'm indexing through each of the elements.</p>
  
  <p>:)</p>
  
  <p>UPDATE:
  Okay, I tried this and still had the same problem:</p>
  
  <pre><code>foreach(myOtherClass tmpC in tmpClass.anewList)
  {    
      Console.WriteLine(tmpC.theStringInMyClass.ToString());
  }
  </code></pre>
  
  <p>and still for each of the 100 items, I got the same string output... I'm sure I'm doing something completely stupid, but I don't know what yet. I'm still 100% sure that the right string is getting passed in to begin with.</p>
  
  <p>-Adeena</p>
  
  <hr>
  
  <p>Okay, I tried this and still had the same problem:</p>
  
  <pre><code>foreach(myOtherClass tmpC in tmpClass.anewList)
  {
      Console.WriteLine(tmpC.theStringInMyClass.ToString());
  }
  </code></pre>
  
  <p>and still for each of the 100 items, I got the same string output...  I'm sure I'm doing something completely stupid, but I don't know what yet. I'm still 100% sure that the right string is getting passed in to begin with.</p>
  
  <p>-Adeena</p>