Thursday, 5 September 2013

In C#, when I set a new list equal to another list, does it set the new list as a pointer to the other list or is it actually creating a new...

In C#, when I set a new list equal to another list, does it set the new
list as a pointer to the other list or is it actually creating a new...

When I set a new list equal to another list, does it set the new list as a
pointer to the other list or is it actually creating a new list?
For example,
Is...
List<SomeType> newList = oldList;
...the same as...
List<SomeType> newList = new List<SomeType>();
newList.AddRange(oldList);
(oldList is a list of SomeType as well)?

No comments:

Post a Comment