An array stores a fixed-size sequential collection of elements of the same type. We can use them to gather items in a single group, and perform various operations on them.
Arrays are of the following three types in C#.
- One Dimensional Array
Syntax:
DataType[] NameOfArray = new DataType[Number of Elements(Size)];
For Example:
In the above example we have created one dimension array of Type int and having size 5.- Int[] Arr = new int[5];
- Two Dimensional Array
Syntax:
DataType[,] NameOfArray = new DataType[Sze of Rows, Size of Column];
For Example:
In the above example we have created one dimension array of Type Integer.- Int[,] Arr = new int[5,5];
Two Dimensional means the array will look like a table with fixed numbers of rows and columns declared in syntax.
- Jagged Array
Syntax:
DataType[][] NameOfArray = new DataType[Number of Elements(Size)][];
For Example:
Jagged Arrays are basically collection of arrays. In the case of jagged array every Element of an array contains array.- Int[][] Arr = new int[5][];
Advantages
There are some advantages of using Arrays.
- We can create an array instead of creating multiple Variable for the same Memory Location.
- We can store n-numbers of elements in an array.
- Elements of an array are stored with the sequential index order so, it is easy to find any element with their index number directly.
Drawback
- Size (numbers of elements to be stored) is fixed at Compile Time or at the time of initialization of it.
This is the basic concept of creating arrays in C#. You will get the process to insert/select the element using loops and index in an array in my next blog.

Christopher AndrewsPosted Nov 18, 2015, 4:08 AM
Cheers to the article! I have been using a tool called Redfly beta and it has been more than useful and easy to use. I suggest that you try it out too on www.redfly.io