求人解答!!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace do_bound
{
class Program
{
static void Main(string[] args)
{
int[] array1 = new int[5];
for (int i = 0; i < 5; i++)
array1[i] = i + 3;
Console.WriteLine("数组array1的索引的上下限如下: ");
Console.WriteLine("数组array1的索引的上线为: {0},下限为: {1}\n",array1.GetUpperBound(0),array1.GetLowerBound(0));
Console.WriteLine();
Array my3dintarray = Array.CreateInstance(typeof(Int32), 2, 3, 4);
for (int i =my3dintarray.GetLowerBound(0);
i<=my3dintarray.GetUpperBound(0);i++)
for(int j =my3dintarray.GetLowerBound(1);
j<=my3dintarray.GetUpperBound(1);j++)
for (int k = my3dintarray.GetUpperBound(2);
k <= my3dintarray.GetLowerBound(2); k++)
{
my3dintarray.SetValue((i * 100) + (j * 10) + k, i, j, k);
}
Console.WriteLine("多维数组中各维索引的上下限为: ");
for (int i = 0; i < my3dintarray.Rank; i++)
Console.WriteLine("第{0}维的索引下限为: {1},索引上限为: {2}", i, my3dintarray.GetLowerBound(i),
my3dintarray.GetUpperBound(i));
Console.WriteLine();
Console.WriteLine("按任意键退出程序!!");
Console.ReadKey();
}
}
}
这道题目从Array my3dintarray = Array.CreateInstance(typeof(Int32), 2, 3, 4);开始 后面都看不懂了 求高手解答,还有上面的i+3是什么意思 谢谢大神
------解决方案--------------------
有什么不懂得, GetUpperBound等函数,自己看帮助就明白了
------解决方案--------------------
是呀,進入方法的定義,看接口的參數表示什麼意思.多搜搜,懂了就懂了,不懂還是不懂,就是一隔之間