How to use Array.GetLongLength() method to get 64-bit number of elements in a specified dimension of an Array in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            Array arr2D = Array.CreateInstance(typeof(int), 6, 3);

            Console.WriteLine("dimension[0] = {0}", arr2D.GetLongLength(0));
            Console.WriteLine("dimension[1] = {0}", arr2D.GetLongLength(1));
        }
    }
}


/*
run:
   
dimension[0] = 6
dimension[1] = 3
  
*/

 



answered Apr 25, 2016 by avibootz
...