C#遍历二维数组

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 | 引用: 0 | 查看次数: 5714
发表评论
登录后再发表评论!