1
對象的名單上有兩個簡單的模型:使用LINQ,獲得包含特定屬性值
public class Product()
{
public long CategoryId {get; set;}
//...etc
}
public class ProductCategory()
{
public long Id {get; set;}
//...etc
}
我寫了一個查詢存儲ProductCategory.Id號碼列表。現在
List<long> activeProductCategories
我想編寫一個LINQ查詢獲取所有具有的CategoryId等於任何長activeProductCategories的產品的清單。
我已經開始寫東西像下面,但還沒有取得多大進展:
List<Product> activeProducts = UnitOfWork.ProductRepository.Get().Where(a=>a.CategoryId //... ?
'。凡(A => activeProductCategories。包含(a.CategoryId);' –
感謝您的幫助! –