Skip to content

Instantly share code, notes, and snippets.

@bzbetty
Created November 15, 2012 09:28
Show Gist options
  • Save bzbetty/4077624 to your computer and use it in GitHub Desktop.
Save bzbetty/4077624 to your computer and use it in GitHub Desktop.
foreach (var child in source.ChildCollection)
{
var targetChild = target.ChildCollection.SingleOrDefault(c => c.Equals(child)); //overwrite Equals or replace comparison with an Id comparison
if (targetChild == null) target.ChildCollection.Add(Mapper.Map<SourceChildType, TargetChildType>(child)); else Mapper.Map(child, targetChild);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment