![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to use the GetLongLength method of array class in C#?
The GetLongLength method in C# gets a 64-bit integer that represents the number of elements in the specified dimension of the Array.
First, set the array.
long[,] arr2= new long[15, 35];
For a specified dimension of the array, set the index in the GetLongMethod() method like −
long len2 = arr2.GetLongLength(0);
Let us see the complete example.
Example
using System; class Program { static void Main() { int[,] arr = new int[20, 30]; int len = arr.GetLength(0); Console.WriteLine(len); long[,] arr2= new long[15, 35]; long len2 = arr2.GetLongLength(0); Console.WriteLine(len2); } }
Output
20 15
Advertisements