
- 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 to define an array class in C#?
The Array class is the base class for all the arrays in C#. It is defined in the System namespace and has the following properties −
Sr.No | Property & Description |
---|---|
1 | IsFixedSize Gets a value indicating whether the Array has a fixed size. |
2 | IsReadOnly Gets a value indicating whether the Array is read-only. |
3 | Length Gets a 32-bit integer that represents the total number of elements in all the dimensions of the Array. |
4 | LongLength Gets a 64-bit integer that represents the total number of elements in all the dimensions of the Array. |
5 | Rank Gets the rank (number of dimensions) of the Array. |
To define an array class, you can try to run the following code, wherein we are sorting an array −
Example
using System; namespace Demo { class MyArray { static void Main(string[] args) { int[] list = { 45, 19, 9, 28, 87}; int[] temp = list; Console.Write("Original Array: "); foreach (int i in list) { Console.Write(i + " "); } Console.WriteLine(); Array.Sort(list); Console.Write("Sorted Array: "); foreach (int i in list) { Console.Write(i + " "); } Console.WriteLine(); Console.ReadKey(); } } }
Output
Original Array: 45 19 9 28 87 Sorted Array: 9 19 28 45 87
- Related Articles
- How to define an array in C#?
- How to define a class in Arduino?
- How to define an array size in java without hardcoding?
- How to define the rank of an array in C#?
- How to define attributes of a class in Python?
- Can we define an enum inside a class in Java?
- How to define a rectangular array in C#?
- How to edit values of an object inside an array in a class - JavaScript?
- Can we define an interface inside a Java class?
- Can we define a parameterized constructor in an abstract class in Java?
- What is an array class in C#?
- How to define an Arrow Function in JavaScript?
- Can we define an abstract class with no abstract methods in Java?
- How to define a single-dimensional array in C Sharp?
- Can we define an abstract class without abstract method in java?\n\n

Advertisements