Using T type parameter to clone a collection I want to clone a collection with the following method and I want to know if it can be optimized:

public T CloneCollection&lt;T&gt;(IEmployees employees) where T : IEmployees, new()
{
    T collection = new T();
    foreach (IEmployee employee in employees)
    {
        collection.Add(employee);
    }
    return collection;
}


These are the other classes which are related to the method above:

public class RegularEmployee : Entities, IEmployee
{
//properties
}

public class User : Entities, IEmployee
{
//properties
}

public class Manager : Entities, IEmployee
{
//properties
}

public class ManagerCollection : List&lt;Manager&gt;, IEmployees
{
   void Add(IEmployee employee);
}

public class RegularEmployeeCollection : List&lt;RegularEmployee&gt;, IEmployees
{
   void Add(IEmployee employee);
}

public class UserCollection : List&lt;User&gt;, IEmployees
{
   void Add(IEmployee employee);
}
You can replace your loop with AddRange():

public T CloneCollection&lt;T&gt;(IEmployees employees) where T : IEmployees, new()
{
    T collection = new T();
    collection.AddRange(employees);
}


Additional thought:

Note that your solution and this solution are simply cloning the list and not the items in the list.  If you update an Employee, the employee will be modified in both lists.  If this is NOT the desired behavior, you will need to clone each employee as well.