【发布时间】:2012-12-11 21:02:25
【问题描述】:
我有一个 ObservableCollection,其中包含另一个 ObservableCollection。
ObservableCollection<MyModel> models = new ObservableCollection<MyModel>();
我的模型是这样的:
public class MyModel
{
public ObservableCollection<MyModel2> list2 { get; set; }
public string Property1 { get; set; }
}
public class MyModel2
{
public string Property2 { get; set; }
public string Property3 { get; set; }
}
现在我想在 "Property2" == "test1" 和 "Property3" == "test2" 的模型中找到所有 MyModel2 项目
我知道如何只在一个 list2 中搜索以找到正确的项目,但我想在模型集合中搜索所有“list2”。
var result = from mod
in list2
where mod.Property2 == "test1" && mod.Property3 == "test2"
select mod;
任何帮助将不胜感激。
【问题讨论】: