Give I have a 3D map of type whose the length and width are uniform but the depth is jagged:
public class Map<T>
{
T[,][] map;
...
}
What is the best way to return a 1D array of all of the objects of type that exist within a volume defined by a 2D area and all of depth within that area. For example I might have an array notation override as follows:
public IEnumerable<T> this[Rectangle area]
{
get {...}
}
or just
public IEnumerable<T> this[int x, int y, int width, int length]
{
get {...}
}
I am honestly hoping for an fast LINQ solution but performance is preferable to visual elegance of the solution. The order of the objects within the flattened array that is returned is unimportant. If anyone has any suggestions or experience with this please share your wisdom.
Alternatively if there is another data structure at my disposal that can perform the same function that I am unaware of, I will gladly use that instead.
If something about my question is unclear please ask for further details.