【发布时间】:2012-05-24 21:59:35
【问题描述】:
我有以下业务对象:
public class ItemCategoryBO
{
public string ItemCategory { get; set; }
public string Title { get; set; }
}
public class ItemBO
{
public int ItemId { get; set; }
public string Title { get; set; }
public string ItemCategory { get; set; }
}
List<ItemCategoryBO> categoryList = new List<ItemCategoryBO>();
ItemCategoryBO itemCategory = new ItemCategoryBO();
itemCategory.ItemCategoryCd = "CARS";
itemCategory.Title = "Cars";
ItemCategoryBO itemCategory2 = new ItemCategoryBO();
itemCategory.ItemCategoryCd = "PLANES";
itemCategory.Title = "Planes";
categoryList.Add(itemCategory);
categoryList.Add(itemCategory2);
List<ItemBO> itemList = new List<ItemBO>();
ItemBO item1 = new ItemBO();
item1.ItemId = 1;
item1.Title = "1st item";
item1.ItemCategoryCd = "OTHER";
ItemBO item2 = new ItemBO();
item2.ItemId = 2;
item2.Title = "2nd Item";
item2.ItemCategoryCd = "CARS";
ItemBO item3 = new ItemBO();
item3.ItemId = 3;
item3.Title = "3rd Item";
item3.ItemCategoryCd = "PLANES";
itemList.Add(item1);
itemList.Add(item2);
itemList.Add(item3);
如果我有几个类别的列表,如何在类别列表中找到包含某个类别的项目列表? (在我的示例中,我想取回第 2 项和第 3 项)
【问题讨论】:
-
你的清单是什么?可以肯定的是,这里的“过滤依据”是什么意思?
-
我真的不明白这里的反对票。弄清楚 OP 的要求并不难。如果你真的认为它已经足够糟糕以至于需要投反对票,请给 OP 留下一些反馈来解释你投反对票的原因。
-
@CharlieKilian 真的不明白吗?评论后
It isn't very hard to figure out what the OP is asking for? -
抱歉没有详细说明,我已经更新了我的问题 :) 谢谢。