我有这段代码:
public class OrderModel
{
public List<Order> Orders { get; set; }
}
public class Order
{
public string Code { get; set; }
public DateTime CreationDate { get; set; }
public Customer Customer { get; set; }
}
public class Customer
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
我希望List<MyClass>
MyClass看起来像:
public class MyClass
{
public string OrderCode { get; set; }
public string OrderCreationDate { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
Automapper可以帮助我吗?如果没有其他解决方案可以避免循环?
谢谢,
答案 0 :(得分:2)