map objects c# with automapper library
public class Customer { public string Name { get; set; } public string Address { get; set; } } public class CustomerDto { public string Name { get; set; } public string Address { get; set; } } // mapper config var config = new MapperConfiguration(cfg => { cfg.CreateMap<Customer, CustomerDto>(); }); var mapper = config.CreateMapper(); // do your mapping return mapper.Map<CustomerDto>(customer);