Hello, I'm working with C # and I have the following situation:
- I have 2 classes in the system,
Order
andProductSold
; -
Order
contains as propertyList<ProductSold>
; - In a given ViewModel, I have to get a list of
ProductSold
that are within aList<Order>
;
The classes are as follows ...
public class ProductSold
{
...
}
public class Order
{
public List<ProductSold> ProductSolds { get; set; }
}
public class ViewModel
{
public void getProductSolds(List<Order> orders)
{
return orders.Select(x => x.ProductSolds).toList(); // ???
}
}
Doing this, I end up with a list of ProductSold
lists. I need to merge these lists and return only one. How to proceed?