I have two for loops to remove item from the list. I am looking for an equivalent LINQ statement for these loops
for (Int32 i = points.Count - 1; i >= 0; i--)
{
for (Int32 j = touchingRects.Count - 1; j >= 0; j--)
{
if (touchingRects[j].HitTest(points[i], rect.TopEdge.Y1))
{
points.RemoveAt(i);
}
}
}
So far I am able to do this but the compiler doesn't understand this code:
points.RemoveAll(p => touchingRects.Where(r => r.HitTest(p, r.TopEdge.Y1)));
Any help will be appreciated.