Source source = new Source()
{
Id = 1,
Login = "Login",
Nickname = "OldNickname"
};
Destination dest = new Destination()
{
Nickname = "NewNickName"
};
Mapper.Initialize(cfg => cfg.CreateMap<Source,Destination>()
.ForMember(d => d.Nickname, (options) => options.Ignore()));
Mapper.Map(source, dest);
foreach (var property in dest.GetType().GetProperties())
{
Console.WriteLine($"{property.Name}: {property.GetValue(dest)}");
} |