Venciity

[Jumpstart C#] Create three-dimensional array

Feb 25th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace three_dimensional_array
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             char[, ,] chCube =
  14.             {
  15.                 //first layer
  16.               {
  17.                {'a', 'b', 'c'}, //row 0 values
  18.                {'d', 'e', 'f'}, //row 1 values
  19.                {'g', 'h', 'i'}  //row 2 values
  20.               },
  21.                 //second layer
  22.               {
  23.                {'j', 'k', 'l'}, //row 0 values
  24.                {'m', 'n', 'o'}, //row 1 values
  25.                {'p', 'q', 'r'}  //row 2 values
  26.               },
  27.                 //third layer
  28.               {
  29.                {'s', 't', 'u'}, //row 0 values
  30.                {'v', 'w', 'x'}, //row 1 values
  31.                {'y', 'z', '0'}  //row 2 values
  32.               }
  33.             }; //The cube size is 3 x 3 x 3 (3 layers, 3 rows, 3 columns)
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment