文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
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]);

                }
               
            }
        }
    }
}

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载