How can I make a Linq query to grab ALL Productpricediscounts from a category?
public class ProductCategory
{
public List categoryProducts
You need Enumerable.SelectMany
var result = categoryProducts.SelectMany(x => x.productPrices)
.SelectMany(x => x.priceDiscounts);
You'll need to use SelectMany in order to access priceDiscounts
:
var query = categoryProducts
.SelectMany(x => x.productPrices)
.SelectMany(y => y.priceDiscounts);