C# Array ClassLast Updated : 17 Jan 2026 In the C# programming language, the array class is in the System namespace, which offers techniques for array creation, searching, sorting, and manipulating arrays. However, it is not part of the System.Collections namespace, it implements interfaces like IList, ICollection, and IEnumerable, which allows it to be treated as a collection. ![]() Syntax of Array Class:It has the following syntax. In this syntax,
C# Array Class ExampleLet’s take an example to define the array class in C#. ExampleCompile and RunOutput: The Length of the original array: 6 The Sorted original array elements: 0 5 7 8 9 25 The Index position of 25 is 5 The Copied array elements: 0 5 7 8 9 25 The Original array in reverse order: 25 9 8 7 5 0 Explanation: In this example, we create an integer array and assign the values to it. The elements are rearranged in a sorted order using the sort() function, and then it prints the sorted elements. After that, it copies the sorted array into a new array and displays the copied values. Finally, it reverses the original array and prints the reversed elements. Important Points of the Array Class in C#:There are several important points of the array class in C#. Some of them are as follows:
C# Array PropertiesThere are several properties of the array class in C#. Some of them are as follows:
C# Array MethodThere are several methods of the array class in C#. Some of them are as follows:
Illustration of the Array Length propertyLet’s take an illustrate example to determine the size of an array using the Length property in the C# programming language. ExampleCompile and RunOutput: The length of the array is: 5 Explanation: In this example, first, we create an integer array and assign the values. After that, we use the Length property to calculate the size of an array. Finally, we use the Console.WriteLine() function to print the output. Example: Using the rank property to determine the array dimensionsLet’s take an illustrate example to calculate the array dimensions using the rank property. ExampleCompile and RunOutput: The number of dimensions: 1 Elements of the array: 10 20 30 40 50 Explanation: In this example, first, we create a one-dimensional array in C#, and then use the rank property to calculate the dimensions of the array. After that, we use the for loop to iterate over the elements of the array. Finally, we are using the Console.WriteLine() function to print the output. ConclusionIn the C# programming language, the array class is in the System namespace, which offers techniques for array creation, searching, sorting, and manipulating arrays. It is the key factor for any programmer to create a software application. It has several properties and methods to perform a particular task. Next TopicC# Command Line Arguments |
We request you to subscribe our newsletter for upcoming updates.