How do I clone a generic list in C#?

2021-04-11 23:25

阅读:431

标签:gen   class   one   ati   listt   ons   c#   toc   eric   

static class Extensions
{
    public static IList Clone(this IList listToClone) where T: ICloneable
    {
        return listToClone.Select(item => (T)item.Clone()).ToList();
    }
}

How do I clone a generic list in C#?

标签:gen   class   one   ati   listt   ons   c#   toc   eric   

原文地址:https://www.cnblogs.com/kevin1988/p/9023294.html


评论


亲,登录后才可以留言!