木子屋 Dnawo's BLOG

C#遍历二维数组

👤 dnawo 📅 2011-01-17 👁 6292 👍 0 💬 0 🔄 本站原创
using System;

namespace ConsoleApplication1
{
    class Program
    {
        public static void Main(string[] args)
        {
            int[,] ids = new int[4, 2] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } };
            for (int i = 0; i < ids.GetLength(0); i++)
            {
                for (int j = 0; j < ids.GetLength(1); j++)
                {
                    Console.Write(ids[i, j] + "\t");
                }
                Console.WriteLine("");
            }

            Console.ReadLine();
        }

    }
}

评论(0)

暂无评论。

计算题
评论需审核通过后显示
← 上一篇 ASP.NET+JQuery.imgAreaSelect在线裁切… 下一篇 → 支付宝在线收款业务接入答疑