2
Answers

NP66 GetLength(0) and Length

Maha

Maha

16y
1.9k
1

Hi Guys

 

NP66   GetLength(0) and Length

 

GetLength(0) and Length producing same results. I wish to know whether

These are same or different. Anyone knows please explain.

 

Thank you

 

using System;

 

class MainClass

{

    static void Main()

    {

        int[] arr = new int[] { 15, 20, 5, 25, 10 };

 

        Console.WriteLine("GetLength(0) = {0}", arr.GetLength(0));

        Console.WriteLine("Length = {0}", arr.Length);

    }

}

/*

GetLength(0) = 5

Length = 5

*/

Answers (2)