Write C# Program to get the Length of the Array


Introduction

I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.

techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. using System;
  2. class Program
  3. {
  4. static void Main()
  5. {
  6.  
  7. int[] arrayA = new int[10];
  8. int lengthA = arrayA.Length;
  9. Console.WriteLine("Length of ArrayA : {0}", +lengthA);
  10. long longLength = arrayA.LongLength;
  11. Console.WriteLine("Length of the Long Length Array : {0}", longLength);
  12. int[,] twoD = new int[20, 50];
  13. Console.WriteLine("The Size of 2D Array is : {0}", twoD.Length);
  14. Console.ReadLine();
  15. }
  16. }

Result

C# language techstudy

     





Related Topics




Popular Posts