Learn Visual C#
C# Array Complete Guide With Programming Example
√ What is array in C#?
√ What is the use of Array?
√ How to define Array?
What is array in c#?
Array is a collection of same type variable which stored in contiguous memory location. It means if you have to define 10 integer variables for different task, you can initialize an integer array with 10 elements. Element represents a single block of array. It will not only make your program simple but gives you better way to work with C#. An array element can be accessed by its index number.
What is the use of array?
While working on real time programming you will feel the need of array several times. Several times you need to keep some same type value in a group. This value might be int, string or character. Apart from it an array gives a way to perform various operations on it.
How to declare an Array?
You can declare array as follow:
How many types of array in C#?
There are actually 2 types of array is available in C sharp.
- One Dimensional Array
- Multi-Dimensional Array
We will learn both type arrays in details with programming example in next chapter.