Bryan

Bryan

  • NA
  • 1
  • 1.9k

List's select method question

Aug 11 2010 9:25 PM
Hi all

Currently, I am using the select at this way to assign values to my OrderDetailDTO object.

 
List ordereportlist = orderdetailBO.GetOrderDetailbyOrderId(OrderId).Select(p => new OrderDetailDTO { ID = p.ID, OrderId = p.OrderId, FileName = p.FileName, Remark = p.Remark }).ToList();


But I think this way is better, and I get an error from complier:

 List ordereportlist = orderdetailBO.GetOrderDetailbyOrderId(OrderId).Select(p => { OrderDetailDTO.Mapping(p); }).ToList();

OrderDetailDTO.Mapping return a new OrderDetailDTO. Have I used the select wrong? Could you help me point out way p?