Clone IList - CSharp System.Collections.Generic

CSharp examples for System.Collections.Generic:IList

Description

Clone IList

Demo Code


using System.Linq;
using System.Text;
using System.Collections.Generic;
using System;/* w ww  . jav a2  s  .c  om*/

public class Main{

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

Related Tutorials