Friday, 1 December 2017

C# Program to get the Length of the Array


Code:

using System;
class Program
{
    static void Main()
    {

        int[] arrayA = new int[5];
        int lengthA = arrayA.Length;
        Console.WriteLine("Length of ArrayA : {0}", +lengthA); 
        long longLength = arrayA.LongLength;
        Console.WriteLine("Length of the LongLength Array  : {0}",longLength);
        int[,] twoD = new int[5, 10];
        Console.WriteLine("The Size of 2D Array is : {0}",twoD.Length);
        Console.ReadLine();
    }
}


Output:

Length of ArrayA : 5
Length of the LongLength Array is :5
The Size of 2D Array is : 50


More C# Programs:




















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...