using System; public class MultidimensionalArray { public static void Main() { int[] lowerBounds = {1, 2, 4}; int[] lengths = {4, 2, 1}; Console.WriteLine ("One dimensional array lower bound = {0}", new string[10].GetLowerBound (0)); Array array = Array.CreateInstance (typeof (int), lengths, lowerBounds); Console.WriteLine ("Bounds dimension {0} = [{1},{2}]", 0, array.GetLowerBound (0), array.GetUpperBound (0)); Console.WriteLine ("Bounds dimension {0} = [{1},{2}]", 1, array.GetLowerBound (1), array.GetUpperBound (1)); Console.WriteLine ("Bounds dimension {0} = [{1},{2}]", 2, array.GetLowerBound (2), array.GetUpperBound (2)); } }
Search
Create a multidimensional array
This C# code snippet creates a multidimensional Array of the specified Type, dimension lengths, and lower bounds.