I'm trying to test what kind of array an object is: 1D, 2D, or an array of arrays/jagged array.
Here's what I tried:
if (o is Array && ((Array)o).Rank == 2) {
Console.Write ("2D-Array: ");
}
/* else if (o[0] is Array) {
Console.WriteLine ("Jagged Array: ");
} */
else if (o is Array) {
Console.Write ("1D-Array: ");
}
But the middle test doesn't work because Cannot apply indexing with [] to an expression of type 'object'
How else could you do this? Thanks in advance.
new object[]{new object[0],3}a jagged array?