[C#] C#创建多维数组代码 →→→→→进入此内容的聊天室

来自 , 2021-03-25, 写在 C#, 查看 152 次.
URL http://www.code666.cn/view/54baf7f8
  1. using System;
  2.  
  3. public class MultidimensionalArray
  4. {
  5.    public static void Main()
  6.    {
  7.       int[] lowerBounds = {1, 2, 4};
  8.       int[] lengths     = {4, 2, 1};
  9.       Console.WriteLine
  10.          ("One dimensional array lower bound = {0}",
  11.          new string[10].GetLowerBound (0));      
  12.       Array array = Array.CreateInstance
  13.          (typeof (int), lengths, lowerBounds);
  14.       Console.WriteLine
  15.          ("Bounds dimension {0} = [{1},{2}]",
  16.          0, array.GetLowerBound (0), array.GetUpperBound (0));
  17.       Console.WriteLine
  18.          ("Bounds dimension {0} = [{1},{2}]",
  19.          1, array.GetLowerBound (1), array.GetUpperBound (1));
  20.       Console.WriteLine
  21.          ("Bounds dimension {0} = [{1},{2}]",
  22.          2, array.GetLowerBound (2), array.GetUpperBound (2));
  23.    }
  24. }
  25.  
  26.  
  27. //csharp/4152

回复 "C#创建多维数组代码"

这儿你可以回复上面这条便签

captcha