
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
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;
- Related Articles
- How do I find the length of an array in C/C++?
- How do you find the number of dimensions of an array in C#?
- How do you print the content of an array in Java?
- How do you empty an array in C#?
- How do you make an array in Python?
- How to find the length of an array in JavaScript?
- How do you convert an ArrayList to an array in Java?
- How do you find the sum of all the numbers in a java array
- How do you limit an array sub-element in MongoDB?
- How do you perform an AND query on an array in MongoDB?
- How do you sort an array in C# in ascending order?
- How do you sort an array in C# in descending order?
- How do you check if a variable is an array in JavaScript?
- How do you convert a list collection into an array in C#?
- How do you remove an array element by its index in MongoDB

Advertisements