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

Kindle Paperwhite High Resolution Display Tablet | Rs. 9999

  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


Responses




Popular Posts

Facebook

Founded in 2016, Tech Study passionately delivers stylish and dynamic innovative information to programmer and technology lovers. http://www.techstudy.org/.