How to select a rectangle from List<Rectangle[]> with Linq
- by dboarman
I have a list of DrawObject[]. Each DrawObject has a Rectangle property. Here is my event:
List<Canvas.DrawObject[]> matrix;
void Control_MouseMove ( object sender, MouseEventArgs e )
{
IEnumerable<Canvas.DrawObject> tile = Enumerable.Range( 0, matrix.Capacity - 1)
.Where(row => Enumerable.Range(0, matrix[row].Length -1)
.Where(column => this[column, row].Rectangle.Contains(e.Location)))
.????;
}
I am not sure exactly what my final select command should be in place of the "????". Also, I was getting an error: cannot convert IEnumerable to bool.
I've read several questions about performing a linq query on a list of arrays, but I can't quite get what is going wrong with this. Any help?
Edit
Apologies for not being clear in my intentions with the implementation.
I intend to select the DrawObject that currently contains the mouse location.