The source code to demonstrate the LongLength property of an array in C# is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.
//Program to demonstrate LongLength
//property of Array in C#.
using System;
class Program
{
static void Main()
{
int[] intArray = new int[500];
long len64 = intArray.LongLength;
Console.WriteLine("LongLength of intArray : "+len64);
}
}
Output:
LongLength of intArray : 500
Press any key to continue . . .
Explanation:
In the above program, we created a program class that contains the Main() method. In the Main() method we created integer array intArray with size 500. Then we used LongLength property. The LongLength property is used to get the 64-bit length of the array, it returns a long value instead of an int value. Then we printed the len64 variable on the console screen.
Program:
The source code to demonstrate the LongLength property of an array in C# is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.
Output:
Explanation:
In the above program, we created a program class that contains the Main() method. In the Main() method we created integer array intArray with size 500. Then we used LongLength property. The LongLength property is used to get the 64-bit length of the array, it returns a long value instead of an int value. Then we printed the len64 variable on the console screen.