public static void ListCopy(IList<T> src, IList<T> dest)
{
if (src == null)
{
throw new System.ArgumentNullException("src", "src is null!");
}
if (dest == null)
{
throw new System.ArgumentNullException("dest", "dest is null!");
}
dest.Clear();
foreach (T item in src)
{
dest.Add(item);
}
}
深拷贝吗?
有个简单的方法
IList<string> list1 = new List<string>(); //源list
IList<string> list2 = new List<string>(list2); //目的list