我有以下课程
class Contact
{
string FirstName;
string LastName;
List<Phone> ContactNumbers;
}
class Phone
{
string Number;
PhoneType Type;
}
enum PhoneType
{
Home, Work, Fax
}
class Source
{
Contact Agent;
Contact Customer;
}
class Destination
{
string AgentFirstName;
string AgentLastName;
string AgentPhoneNumber1;
string AgentPhoneNumber2;
string AgentPhoneNumber3;
PhoneType AgentPhoneType1;
PhoneType AgentPhoneType2;
PhoneType AgentPhoneType3;
string CustomerFirstName;
string CustomerLastName;
string CustomerPhoneNumber1;
string CustomerPhoneNumber2;
string CustomerPhoneNumber3;
PhoneType CustomerPhoneType1;
PhoneType CustomerPhoneType2;
PhoneType CustomerPhoneType3;
}
我想做从源到目标类的自动映射。我看到的挑战是将联系人号码列表转换为目标类中的独立字段。有人可以建议方法吗?提前致谢。