Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace DimensionTest
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[][][] test = {
- new string[][] {
- new string[] { "AA", "AB" }, new string[] { "BA", "BB" }
- },
- new string[][] {
- new string[] { "CA", "CB" }, new string[] { "DA", "DB" }
- }
- };
- string[][] test2 = { new string[] { "A" },
- new string[] { "B" },
- new string[] { "C" },
- new string[] { "D" } };
- IterateArray(test, "test");
- IterateArray(test2, "test2");
- Console.ReadLine();
- }
- static void IterateArray(Array arr, string name)
- {
- Console.WriteLine("Iterating \"" + name + "\"");
- Iterate(arr);
- }
- static void Iterate(Array arr)
- {
- if (arr is string[])
- foreach (string s in arr)
- Console.WriteLine(s);
- else
- foreach (Array sub in arr)
- Iterate(sub);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement