What does Array.LongLength property of array class do in C#?

CsharpProgrammingServer Side Programming

The Array.LongLength property gets a 64-bit integer that represents the total number of elements in all the dimensions of the Array.

Let’s say your array of long data type is −

long[,] arr1= new long[15, 35];

Use the LongLength property to get an integer representing the total number of elements in all dimensions of the Array −

arr1.LongLength

Let us see an example to implement the Array.LongLength property of array class −

Example

 Live Demo

using System;

class Program {
   static void Main() {

      long[,] arr1= new long[15, 35];
      long len1 = arr1.GetLongLength(0);

      Console.WriteLine(len1);
      Console.WriteLine(arr1.LongLength);
   }
}

Output

15
525
raja
Published on 08-Aug-2018 09:19:59
Advertisements