1
私はマルチファセットエンジンで作業しています。nhibernateリストを別のオブジェクトリストでフィルタリングする
ResultProduct
public int Id { get; set; }
public int Name { get; set; }
public int Brand { get; set; }
[...]
と
Brand
public int Id { get; set; }
public int Name { get; set; }
public IList<Product> Product { get; set; }
[...]
私がきた両方のクラスの一覧:
私は、クラスの2種類をしました。
- リスト< ResultProduct>には検索結果が含まれています。
- リスト<ブランド>ブランドのリストが含まれています。
私の目的は、これ以上ResultProductにないブランドをすべて削除することです。 (他の基準で)。
どうすればいいですか?
編集:あなたの答えのための
ありがとうpektov。 商品がないすべてのブランドを削除したいと考えています。
私は別の解決策を見つけました。
brands = (from brand in brands
where (from res in resultSearch select res.Brand.IdBrand).Contains(brand.IdBrand)
select brand).ToList<Brand>();
あなたのソリューションはパフォーマンスが向上すると思いますが、どう思いますか?
を私は別の解決策を見つけ、私は質問を編集しました。どのような解決策があなたに最適ですか? –
大きな違いはないと思います。 –