Why does copy of the List still change properties in the original List using C#

后端 未结 6 1676
不知归路
不知归路 2021-01-21 02:49

Lets say I have this class

public class Employee
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public bool isActive {          


        
6条回答
  •  面向向阳花
    2021-01-21 03:25

    The copy you create is just a copy of the list. Not a copy of the objects. In other words, Employees[0] == EmployeesCopy[0].

提交回复
热议问题