Array.Rank is used in determining total dimensions of an array
Example of Array.Rank Property
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSharpDemoApps
{
class Program
{
static void Main(string[] args)
{
// Creates and initializes a new integer array.
int[] myIntArray = new int[5] { 1, 2, 3, 4, 5 };
//Total dimensions of Array is determined using Rank Property
Console.WriteLine("Total dimensions of Array is : " + myIntArray.Rank);
Console.ReadLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSharpDemoApps
{
class Program
{
static void Main(string[] args)
{
// Creates and initializes a new integer array.
int[,] myIntArray = new int[2, 5] {
{ 1, 2, 3, 4, 5 },
{ 1, 2, 3, 4, 5 }
};
//Total dimensions of Array is determined using Rank Property
Console.WriteLine("Total dimensions of Array is : " + myIntArray.Rank);
Console.ReadLine();
}
}
}