VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/how-to-find-the-length-of-an-array-in-c-sharp/

⇱ How to find the length of an Array in C# - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to find the length of an Array in C#

Last Updated : 11 Jul, 2025
Array.Length Property is used to get the total number of elements in all the dimensions of the Array. Basically, the length of an array is the total number of the elements which is contained by all the dimensions of that array. Syntax:
public int Length { get; }
Property Value: This property returns the total number of elements in all the dimensions of the Array. It can also return zero if there are no elements in the array. The return type is System.Int32. Exception: This property throws the OverflowException if the array is multidimensional and contains more than MaxValue elements. Here MaxValue is 2147483647. Below programs illustrate the use of above-discussed property: Example 1:
Output:
Sun Mon Tue Wed Thu Fri Sat 
Total Number of Elements: 7
Example 2:
Output:
Total Number of Elements in intarray: 8
Total Number of Elements in intarray_d: 8
Total Number of Elements in intarray3D: 12
Total Number of Elements in intarray3Dd: 12
Reference:
Comment
Article Tags:
Article Tags:

Explore