09-21-2013, 07:19 AM
U are trying to add the same class and just changed some values.
The values inside a class are passed by reference.
So lets say your class named Items. And u do this.
Items itemA = new Items();
itemA.id = 1;
Items itemB = itemA;
itemB.id = 2;
U would think that itemB is a copy of itemA with only a different id.
But its not. itemB is a reference to itemA. So everything u change in itemB gets changed in itemA aswell.
If u really want to make a copy lookup MemberwiseClone()

