using System;
class MyArrayRankSample
{
public static void Main()
{
try
{
int[,,] myArray = new int[,,] {{{1,2,5},{3,8,3}},{{2,2,5},{3,7,3}}};
Type myType = myArray.GetType();
Console.WriteLine("Contents of myArray: {{{1,2,3},{3,7,3}},{{9,4,1},{3,7,3}}}");
Console.WriteLine("myArray has {0} dimensions.", myType.GetArrayRank());
}
catch(NotSupportedException e)
{
Console.WriteLine("NotSupportedException raised.");
Console.WriteLine("Source: " + e.Source);
Console.WriteLine("Message: " + e.Message);
}
catch(Exception e)
{
Console.WriteLine("Exception raised.");
Console.WriteLine("Source: " + e.Source);
Console.WriteLine("Message: " + e.Message);
}
}
}