public ArrayDataView(Array array)
{
if (array.Rank > 2)
throw new ArgumentException("Supports only up to two dimensional arrays", "array");
this.data = array;
if (array.Rank == 2)
{
rowCount = array.GetLength(0);
colCount = array.GetLength(1);
type = ArrayDataType.Multidimensional;
}
else
{
if (array.GetValue(0) is Array)
{
Array row = array.GetValue(0) as Array;
rowCount = array.GetLength(0);
colCount = row.GetLength(0);
type = ArrayDataType.Jagged;
}
else
{
rowCount = 1;
colCount = array.GetLength(0);
type = ArrayDataType.Simple;
}
}
rows = new ArrayRowView[rowCount];
for (int i = 0; i < rows.Length; i++)
rows[i] = new ArrayRowView(this, i);
}