Q:

C# program to demonstrate the example of LongLength property of array

belongs to collection: C# Basic Programs | array programs

0

C# program to demonstrate the example of LongLength property of array

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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.

//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.

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C# Basic Programs | array programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
C# program to print the lower bound and upper boun... >>
<< C# program to convert a two-dimensional array into...