0
class objA
{
    public Rectangle area;    
}

class objB
{
    public Point somepoint;
}


List<objA> listA;
List<objB> listB;

现在,我想在任何地方获取 listA 和 listB 中的元素objA.area.contains(objB.point)

4

2 回答 2

1

这应该可以解决问题:

result = listA.Select(a=>
new{ 
    Rectangle = a, 
    Points =listB.Where(b=>a.Contains(b))
});
于 2013-06-22T12:27:46.037 回答
0

您可能会考虑进行from from where样式查询,也称为非 equi 连接:

from rect in listA
from point in listB
where rect.Area.Contains(point.SomePoint)
select new { rect, point }
于 2013-06-22T12:31:52.910 回答