public static void Copy(RDomCollection <T> source, RDomCollection <T> target) { foreach (var item in source) { var copyMethod = item.GetType().GetMethod("Copy"); if (copyMethod == null) { throw new NotImplementedException(); } var newItem = copyMethod.Invoke(item, null); target.AddOrMove(newItem); } }
public RDomCollection <T> Copy(IDom newParent) { var newList = new RDomCollection <T>(newParent); foreach (var item in _list) { var copyMethod = item.GetType().GetMethod("Copy"); if (copyMethod == null) { throw new NotImplementedException(); } var newItem = copyMethod.Invoke(item, null); newList.AddOrMove(newItem); } return(newList); }