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 8412257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:37:43+00:00 2026-06-10T00:37:43+00:00

Is there a way to do a cross section of a 3D Array? What

  • 0

Is there a way to do a cross section of a 3D Array?

What I mean is: Cut the array along the Z axis so you get a 2D plane of the X axis and Y axis.

I need to do this so I can store them as separate sections in an ArrayList, or even potentially a List.

Thanks.

  • 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-06-10T00:37:45+00:00Added an answer on June 10, 2026 at 12:37 am

    I’m not sure C# has an out-of-the-box way of doing this, so you’d have to implement something yourself:

    T[,] SliceThroughZ<T>(T[,,] threeDee, int zIndex)
    {
        var xLength = threeDee.GetLength(0);
        var yLength = threeDee.GetLength(1);
        var twoDee = new T[xLength, yLength];
        for (int i = 0; i < xLength; i++)
            for (int j = 0; j < yLength; j++)
                twoDee[i, j] = threeDee[i, j, zIndex];
    
        return twoDee;
    }
    

    Alternatively, rather than making a copy, you could implement a wrapper class with a two-dimensional indexer that simply queries the original array. You’d lose array-specific methods, though.

    class ZSliceWrapper<T>
    {
        public T[, ,] Source { get; set; }
        public int ZIndex { get; set; }
    
        public T this[int xIndex, int yIndex]
        {
            get // you could even implement a set.
            {
                return Source[xIndex, yIndex, ZIndex];
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been thinking for a while if there's a way to get cross-domain AJAX
Is there any way I can cross-compile C/C++ code for Windows (XP, Vista, Win7),
Is there a way to cross over all elements in integer array using pointer
Surely there must be a way to do this... I can't work it out.
Is there an easy cross-browser way to get computed style of an element in
Is there any way to tell your localhost that it can do cross domain
is there a way to achieve this effect in a cross-browser compatible way without
Is there any way to create a pivot and/or cross-tab query using for SQLite
Is there way to get file from windows xp command prompt? I tried to
is there way how to get name ov event from Lambda expression like with

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.