文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>C# 多维数组.

C# 多维数组.

时间:2010-10-13  来源:胖子黎

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

 

namespace ConsoleApplication1
{
    class Program
    {

        static void Main(string[] args)
        {
            int[][] myArr = new int[2][];
            myArr[0] = new int[3] { 1, 2, 3 };    //需要说下这是锯齿数组才会有下面的  行.length 的属性,试了标准的多维数组没有这属性的。 声明也不一样是 int[,,] 类型。
            myArr[1] = new int[2] { 4, 5 };
            Console.WriteLine(myArr.Rank);
            for (int i = 0; i < myArr.Length; i++)
            {
                for (int j       = 0; j < myArr[i].Length; j++)
                {
                    Console.WriteLine("行数:{0,-5}列数:{1,-5}值为{2,3}",i,j,myArr[i][j]);

                }
               
            }
        }
    }
}

相关阅读 更多 +
排行榜 更多 +
PvZ戴夫的时空冒险重置

PvZ戴夫的时空冒险重置

策略塔防 下载
PVZTV雪版阳光加50

PVZTV雪版阳光加50

策略塔防 下载
双刃战士雪姐

双刃战士雪姐

冒险解谜 下载