LINQクエスト自体で余分なループを回避して順序を構築する方法。
GetOrderListDataContext orderListDaCtx = new GetOrderListDataContext(address);
// This line showing compiler error could not find implementation of query pattern for source type int Select not found
var orderList = from order in orderListDaCtx.Base_Purchase_GetOrderListByUser_WS(request.UserGuid, request.CountryCode, request.FromDate, request.ToDate)
select order;
// Here how i can avoid this loop and construct order object in the LINQ itself above
List<Order> orders = new List<Order>();
foreach (var order in orderList)
{
orders.Add(new Order
{
OrderKey = order.OrderKey,
UserEmail = order.UserEmail,
CreatedDate = order.CreatedDate
});
}
return orders;