Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6941995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:57:28+00:00 2026-05-27T12:57:28+00:00

Give I have a 3D map of type whose the length and width are

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:57:29+00:00Added an answer on May 27, 2026 at 12:57 pm

    This might work as well (without Linq)

        public IEnumerable<T> this[int x, int y, int width, int length]
        {
            get
            {
                for (int i = 0; i < length; i++)
                {
                    for (int j = 0; j < width; j++)
                    {
                        for (int k = 0; k < map[x + i, y + j].Length; k++)
                        {
                            yield return map[x + i, y + j][k];
                        }
                    }
                }
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this interface for using AutoMapper: public interface IMapper { object Map(object source,
I have a function that expects a parameter of type float** , but I
I have a Map (Int, Int) a where a can be any type. Based
I have to give a general note to some huge Java project for which
I have a listbox in which i have to give minimum 2 files for
What would a developer used to working in Visual Studio have to give up
We have a whole bunch of DLLs that give us access to our database
i have created a workflow activity that do give the item creater of a
I have a table that contains tasks and I want to give these an
I have a client that is asking me to give them a listing of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.