Initialization And Declaration Of Array In C#

Occasionally, you need to declare multiple variable of same data type. It is complex and time taking process. Just for an example, you have to declare 100 double type of variable then what would you do? Will you declare variable as like:

doublenum1,num2,num3,num4,num5,num6,num7,num8....num100;

It is not a good way to declare multiple variable of same data type. To overcome this situation, array came alive. An array is a collection of same data type. If you have to declare 100 variable of same data type in C#, then you can declare and initialize an array as follow.