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

Here, we are going to learn how to demonstrate the example of LongLength property of array in C#?
Submitted by Nidhi, on August 22, 2020

Here we create an integer array and use LongLength property of array to get the 64-bit length of the array.

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.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.