private ArrayList CopyToArrayListScalar(object from) { ArrayList result = new ArrayList(1); if (ShallowCopy) { result.Add(from); return(result); } ObjectsMapperBaseImpl Mapper = mapperMannager.GetMapperImpl(from.GetType(), from.GetType(), _mappingConfigurator); result.Add(Mapper.Map(from)); return(result); }
private ArrayList CopyToArrayList(IEnumerable from) { if (ShallowCopy) { if (from is ICollection) { return(new ArrayList((ICollection)from)); } else { ArrayList res = new ArrayList(); foreach (object obj in from) { res.Add(obj); } return(res); } } ArrayList result = new ArrayList(); if (from is ICollection) { result = new ArrayList(((ICollection)from).Count); } else { result = new ArrayList(); } foreach (object obj in from) { if (obj == null) { result.Add(null); } else { ObjectsMapperBaseImpl Mapper = mapperMannager.GetMapperImpl(obj.GetType(), obj.GetType(), _mappingConfigurator); result.Add(Mapper.Map(obj)); } } return(result); }
private object CopyToIList(IList iList, object from) { if (iList == null) { iList = (IList)Activator.CreateInstance(typeTo); } foreach (object obj in (from is IEnumerable ? (IEnumerable)from : new[] { from })) { if (obj == null) { iList.Add(null); } if (_rootOperation == null || _rootOperation.ShallowCopy) { iList.Add(obj); } else { ObjectsMapperBaseImpl Mapper = mapperMannager.GetMapperImpl(obj.GetType(), obj.GetType(), _mappingConfigurator); iList.Add(Mapper.Map(obj)); } } return(iList); }