如果我有 2 个对象集合,是否可以在一个查询中有效地加入它们并从它们中进行选择?
例如:
var collection1 = GetSomeData();
var collection2 = GetSomeMoreData();
var myResult = from x in collection1
from y in collection2
where x.SomeProperty = "Yes"
where y.SomeProperty = "Yes"
select x, select y;
GetSomeData
, 并且GetSomeMoreData
都返回IEnumerable<MyType>
显然这不会编译......但希望它能够说明我正在尝试做这个想法......