Tuesday, January 14, 2014

// // Leave a Comment

How to find Dimension of an array C-Sharp

How to find Dimension of an array C-Sharp


Rank Property is used to find the dimensions of an array
class SampleArray
{
    static void Main()
    {
        // Declare and initialize an array: 
        int[,] Sample = new int[5, 10];
        System.Console.WriteLine("{0} dimensions.", Sample .Rank);
    }
}
// Output: 2 dimensions.

0 comments:

Post a Comment