I'm curious because I have read that once an array is declared it can not be changed. Maybe if I lay out my thoughts.

Say, I have a cube with dimensions 5x5x5 and I have a viewport that can rotate the face of the cube to see object data in a area. Instead of slicing the image in flat planes, is it possible to have an update to array data according to current faced side of cube? Also, can I generate a layer shader to top layer to drop opacity and be able to select or modify interior cubes?

I know I've got to be explaining this badly.

2 Answers 2


You seem to be confusing a lot of things. First of all an array in C# or any other language is referring to a data structure which stores values of certain type like integers, doubles, string etc. This is the representation of data not a rendering of a three dimensional object.

It is correct that a multidimensional array in C# cannot be resized once declared. You would need to declare a new array and copy the elements.

If you treat that 3D array like a cube, you can indeed update certain "slices". The smallest part an array consists of are the elements which can be accessed through their index. You can imagine them as boxes that store content and each have numbers identifying them. For a 3D array, that would be three numbers one for each dimension.

To update what you called a slice you would iterate through all boxes in two dimensions and keep the third fixed. As the 3D is only an abstraction there actually is no side you are facing when treating it figuratively as a thing.

For actual 3D rendering of cubes, which are not the same thing as an array, you might want to check out OpenGL, XNA Game or 3D rendering with WPF.

I hope that clarifies things a little.

Here is a tutorial on how to use arrays, should be simple enough to follow along for a beginner.

As for 3D rendering with C# I am not a great help, because I have never done it myself. But there are plenty tutorials for that as well. For example this.

  • That does clear up some things for me. Rendering would be what i would be aiming at for the representation of the visible model, im trying to figure out how to handle interactivity of the model and the user for information updaying and sharing between boxes and faces, and i was leaning away from arrays do to thier locked type data.... (please forgive my misconceptions on arrays if im still way off), but i dont think coding individual boxes for data entry would be practical in my concept. Sep 8, 2015 at 4:22
  • 1
    Please read the linked tutorial about arrays first. If you then know what I am talking about, and that is not what you meant, I can help you further, but right now you still seem to be mixing a lot of things. Is something like this what you want to accomplish
    – John
    Sep 8, 2015 at 4:35

Suppose you have an array (general sense, not programming sense) of 3D objects in a Cartesian grid of 5 x 5 x 5.

The eight corner cells of the array are (using zero-based indexing):

  • [0][0][0]
  • [0][0][4]
  • [0][4][0]
  • [0][4][4]
  • [4][0][0]
  • [4][0][4]
  • [4][4][0]
  • [4][4][4]

The six faces of the array are (for j, k range from 0 to 4):

  • [0][j][k]
  • [4][j][k]
  • [j][0][k]
  • [j][4][k]
  • [j][k][0]
  • [j][k][4]

Notice that some cells are shared by two or three faces.

In general, you can slice through in 3D space by having a hyperplane separator, which is an inequality.

  • compare(a * x + b * y + c * z + d, 0)

Fix the parameters (a, b, c, d), which defines how the hyperplane slice through the space. For each object, one can check the object's relative position to the hyperplane by plugging the object's (x, y, z) into the inequality, and check the sign of comparison. If the comparison result is greater-than, it is on one side of the hyperplane. If it is less-than, it is on the other side of the hyperplane.

The Wikipedia article linked above teaches how to choose the parameters of that inequality so that the hyperplane will pass through specific points, which would need to be manipulated by the user.

Not the answer you're looking for? Browse other questions tagged or ask your own question.