• Top Posts

    Arrays in C#


    • An array stores a fixed-size sequential collection of elements of the same type. 
    • An array is a group of like-typed variables that are referred to by a common name.
    • All arrays consist of contiguous memory locations.
    • In C#, array is an object of base type System.Array.
    •  In C#, array index starts from 0. We can store only fixed set of elements in C# array.
               
    Declaring a Array:

                datatype[] arrayName;

    1. datatype is used to specify the type of elements in the array.
    2. [ ] specifies the rank of the array. The rank specifies the size of the array.
    3. arrayName specifies the name of the array.
    Array Initialisation:
                  
                 int[] array1= new int[5];



    No comments

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728