3
Answers

How to map Two Objects with properties

Mark Tabor

Mark Tabor

3y
3k
1

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)