I have a class like this:
public class myClass
{
public List anewlist = new List;
public void addToList(myOtherC
Try iterating through the list using foreach rather than by index. I suspect that the problem is in the code that you have omitted from your example, not the list itself.
foreach (MyOtherClass item in tmpClass.anewList)
{
Console.WriteLine( item ); // or whatever you use to write it
}
EDIT
Have you examined the list structure in the debugger to ensure that your unique items are actually added? Also, you might want to use .Count (the property) instead of .Count() (the extension method). The extension method may actually iterate over the list to count the methods, while the property is just looking up the value of a private variable that holds the count.
@James may be onto something here. If you are just changing the properties of the item you've inserted and reinserting it, instead of creating a new object each time, this would result in the behavior you are seeing.