SHARE
TWEET

Untitled

a guest Oct 16th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace DimensionTest
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string[][][] test = {
  14.                 new string[][] {
  15.                     new string[] { "AA", "AB" }, new string[] { "BA", "BB" }
  16.                 },
  17.                 new string[][] {
  18.                     new string[] { "CA", "CB" }, new string[] { "DA", "DB"  }
  19.                 }
  20.             };
  21.             string[][] test2 = { new string[] { "A" },
  22.                                  new string[] { "B" },
  23.                                  new string[] { "C" },
  24.                                  new string[] { "D" } };
  25.             IterateArray(test, "test");
  26.             IterateArray(test2, "test2");
  27.             Console.ReadLine();
  28.         }
  29.  
  30.         static void IterateArray(Array arr, string name)
  31.         {
  32.             Console.WriteLine("Iterating \"" + name + "\"");
  33.             Iterate(arr);
  34.         }
  35.  
  36.         static void Iterate(Array arr)
  37.         {
  38.             if (arr is string[])
  39.                 foreach (string s in arr)
  40.                     Console.WriteLine(s);
  41.             else
  42.                 foreach (Array sub in arr)
  43.                     Iterate(sub);
  44.         }
  45.     }
  46. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top