using System.Collections.Generic;
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
public string Address { get; set; }
public string Email { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
public string Address { get; set; }
public string Email { get; set; }
public static void Main()
var config = new MapperConfiguration(cfg => {
cfg.CreateMap<PersonVM, Person>();
IMapper mapper = config.CreateMapper();
var personVM = new List<PersonVM> { new PersonVM(){ FirstName="Virat" , LastName = "Kohli", Age=27, Address = "Delhi", Email="kohli@test.com" },
new PersonVM(){ FirstName="Ishaant" , LastName = "Sharma", Age=28, Address = "Delhi", Email="ishaant@test.com" },
new PersonVM(){ FirstName="Suresh" , LastName = "Raina", Age=26, Address = "Mumbai", Email="suresh@test.com" }
var person = new List<PersonVM> { new PersonVM(){ FirstName="Virat" , LastName = "Kohli", Age=27, Address = "Delhi", Email="kohli@test.com" },
new PersonVM(){ FirstName="Ishaant" , LastName = "", Age=, Address = "", Email="" },
new PersonVM(){ FirstName="Suresh" , LastName = "Raina", Age=26, Address = "Mumbai", Email="suresh@test.com" }
mapper.Map(personVM,person);
foreach(var item in person)
Console.WriteLine("\nitem.FirstName : {0} \nitem.LastName : {1} \nitem.Age : {2} \nitem.Address : {3} \nitem.Email : {4} ",
item.FirstName, item.LastName, item.Age, item.Address, item.Email);