Traverse a 2D array in reverse order

Topic description  

Traverse the two-dimensional array in reverse order, output the number of elements contained in the array, the upper and lower limits of the dimension of the array, and view the elements of the array. (console application)

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

namespace traverses a two-dimensional array in reverse order
{
    class Program
    {
        static void Main(string[] args)
        {
            string[,] Name = { { "Zhang San", "Male" }, { "Li Si", "Male" }, { "Wang Wu", "Female" } ,{"Zhao Liu","Female"} };
            Console.WriteLine("Output array elements in reverse order");
            for (int i = 2; i >= 0; i--)
            {
                for (int j = 1; j >= 0; j--)
                    Console.Write(Name[i, j] + "\t");
                Console.WriteLine();
            }
            Console.WriteLine(Name.Length);// The array contains the total number of elements
            Console.WriteLine(Name.GetLowerBound(0));//Get the lower limit of the specified dimension
            Console.WriteLine(Name.GetUpperBound(0));//Get the upper limit of the specified dimension
            Console.WriteLine(Name.GetValue(2,1));//View the value of the specified element
            Console.WriteLine(Name[2, 0]);//View the value of the specified element
        }
    }
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325956826&siteId=291194637