class Matrix
{
public Matrix(int rowSize, int colSize)
{
...
}
public Row this [ int index ]
{
get { BoundsCheck(index); ...
}
set { BoundsCheck(index); ...
}
}
//
validation
private void BoundsCheck(int index)
{
if (index < 0 || index >=
rows.Length)
throw new IndexOutOfRangeException();
}
//
representation
private Row[] rows;
}