How do I clone a generic list in C#?

static class Extensions
{
    public static IList<T> Clone<T>(this IList<T> listToClone) where T: ICloneable
    {
        return listToClone.Select(item => (T)item.Clone()).ToList();
    }
}
posted @ 2018-05-11 10:27  天藐水瓶  阅读(82)  评论(0编辑  收藏  举报