Say I have a list of Person
objects (List
) called persons
, like this:
class Person
{
public int PersonId
When you have a list of objects that are reference types and not value types, that is stored in the list is a reference for each object in the list. Hence if you add the same object to two different lists, you actually add to the second list the same reference. Hence if you make any change in the object, this would be "visible" from both lists.