What exactly happens when adding an object to a collection such as List?
List<Person> people = new List<Person>();
Person dan = new Person() { Name="daniel", Age=10 };
people.Add(dan);
dan = new Person() { Name = "hw", Age = 44 };
When I execute the above code, the List<Person> people
does not get affected by final line.
So I am assuming that the list copies the references of the added object, so when change the reference, the list does not get affected. am I correct?