Mark Tabor

Mark Tabor

  • 589
  • 2k
  • 460.2k

How to map Two Objects with properties

Oct 30 2021 9:29 PM

I have two objects request and response and they have few properties like below

public class Employee
{
public string Name{get;set;}
public Address EmployeeAddress{get;set;}

}

Address itself is a class with below properties

public class Address
{
public string Street{get;set;}
public string HouseNo{get;set;}
public List<phone> PhoneDetail{get;set;}
}

Now Phone is itself a class with below schema

public class phone
{
public string mobile {get;set;}
public string Home{get;set;}

}

This above is request object we have a response object having exactly same schema with all classes and properties are same Now I want to map them Like

Request.Name=Response.Name How to do that for all properties specially for Phone which is of type list .


Answers (3)