var config = new MapperConfiguration(cfg =>
cfg.CreateMap<Employee, EmployeeDTO>()
);
//Creating the source object
Employee emp = new Employee
{
Name = "James",
Salary = 20000,
Address = "London",
Department = "IT"
};
//Using automapper
var mapper = new Mapper(config);
var empDTO = mapper.Map<EmployeeDTO>(emp);
//OR
//var empDTO2 = mapper.Map<Employee, EmployeeDTO>(emp);