Skip to content

Commit

Permalink
missed it
Browse files Browse the repository at this point in the history
  • Loading branch information
lbargaoanu committed May 19, 2016
1 parent 6e773ff commit cfbfc88
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/AutoMapper/Mappers/ReadOnlyCollectionMapper.cs
Expand Up @@ -18,10 +18,11 @@ public class ReadOnlyCollectionMapper : IObjectMapExpression
if (source == null && context.Mapper.ShouldMapSourceCollectionAsNull(context))
return null;

IList<TDestinationItem> list = new List<TDestinationItem>();

IList<TDestinationItem> list = new List<TDestinationItem>();

var itemContext = new ResolutionContext(context);
foreach (var item in (IEnumerable)source ?? Enumerable.Empty<object>())
list.Add((TDestinationItem)context.Mapper.Map(item, default(TDestinationItem), typeof(TSourceItem), typeof(TDestinationItem), context));
list.Add((TDestinationItem)itemContext.Map(item, default(TDestinationItem), typeof(TSourceItem), typeof(TDestinationItem)));

return new ReadOnlyCollection<TDestinationItem>(list);
}
Expand Down

0 comments on commit cfbfc88

Please sign in to comment.