
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 do you find the length of an array in C#?
To find the length of an array, use the Array.Length() method.
Example
Let us see an example −
using System; class Program { static void Main(){ int[] arr = new int[10]; // finding length int arrLength = arr.Length; Console.WriteLine("Length of the array: "+arrLength); } }
Output
Length of the array: 10
Above, we have an array −
int[] arr = new int[10];
Now to find the length, we used the Length() method −
int arrLength = arr.Length;
Advertisements