2011-06-21 10 views

Répondre

1
Product foundProduct = productCatList 
      .SelectMany(list => list.Products) 
      .Where(product => product.ProductID == whateverID) 
      .SingleOrDefault()
0

Essayez ceci:

var results = from pc in myProductCats 
       where pc.Products.Contains(ProductId) 
       select pc; 

question que vous manque beaucoup de détails. Si vous fournissez du code et la structure de classe je peux fournir une meilleure réponse.

0

Pour une syntaxe de langage pur Linq:

var pds = from pc in prodCats 
      select from p in pc.Products where p.ProductID < 3 
      select p; 

Mais je pense que l'extension IEnumerable + version lambda est plus lisible.

Questions connexes