コード例 #1
0
    public static void Main()
    {
        EmployeeList team = new EmployeeList();

        team.AddMember(new Employee("A", "AA", 4));
        team.AddMember(new Employee("B", "BB", 8));
        team.AddMember(new Employee("C", "CC", 8));

        EmployeeList clone = (EmployeeList)team.Clone();

        Console.WriteLine("Original EmployeeList:");
        Console.WriteLine(team);

        Console.WriteLine("Clone EmployeeList:");
        Console.WriteLine(clone);

        Console.WriteLine("*** Make a change to original team ***");
        team.EmployeeListMembers[0].Name  = "L";
        team.EmployeeListMembers[0].Title = "M";
        team.EmployeeListMembers[0].Age   = 4;

        Console.WriteLine("Original EmployeeList:");
        Console.WriteLine(team);

        Console.WriteLine("Clone EmployeeList:");
        Console.WriteLine(clone);
    }