protected override object GetOrCreateDestinationObject(ResolutionContext context, IMappingEngineRunner mapper, Type destElementType, int sourceLength) { var sourceArray = context.SourceValue as Array; if (sourceArray == null) { return(ObjectCreator.CreateArray(destElementType, sourceLength)); } var destinationArray = ObjectCreator.CreateArray(destElementType, sourceArray); filler = new MultidimensionalArrayFiller(destinationArray); return(destinationArray); }
public object Map(ResolutionContext context, IMappingEngineRunner mapper) { if (context.IsSourceValueNull && mapper.ShouldMapSourceCollectionAsNull(context)) { return(null); } var sourceElementType = TypeHelper.GetElementType(context.SourceType); var destElementType = TypeHelper.GetElementType(context.DestinationType); var sourceArray = (Array)context.SourceValue ?? ObjectCreator.CreateArray(sourceElementType, 0); var sourceLength = sourceArray.Length; var destArray = ObjectCreator.CreateArray(destElementType, sourceLength); Array.Copy(sourceArray, destArray, sourceLength); return(destArray); }
protected override object GetOrCreateDestinationObject(ResolutionContext context, IMappingEngineRunner mapper, Type destElementType, int sourceLength) { return(ObjectCreator.CreateArray(destElementType, sourceLength)); }