public RectMatrix(int rowCapacity, int columnCapacity)
        {
            this.size = new MatrixSize(0, 0);
            int _rowCapacity    = Math.Max(4, rowCapacity);
            int _columnCapacity = Math.Max(4, columnCapacity);

            this.capacity = new MatrixSize(_rowCapacity, _columnCapacity);
            this.data     = new T[_rowCapacity, _columnCapacity];
        }
 protected virtual void EnsureSizeCore(int rowCount, int columnCount)
 {
     Guard.IsNotNegative(rowCount, nameof(rowCount));
     Guard.IsNotNegative(columnCount, nameof(columnCount));
     EnlargeCapacityIfRequired(rowCount, columnCount, x => {
         T[,] _data = new T[x.RowCount, x.ColumnCount];
         for (int i = 0; i < Capacity.RowCount; i++)
         {
             for (int j = 0; j < Capacity.ColumnCount; j++)
             {
                 _data[i, j] = this.data[i, j];
             }
         }
         this.data     = _data;
         this.capacity = x;
     });
     Size.RowCount    = rowCount;
     Size.ColumnCount = columnCount;
 }
 static bool Equals(MatrixSize x, MatrixSize y)
 {
     return(x.RowCount == y.RowCount && x.ColumnCount == y.ColumnCount);
 }
        public override bool Equals(object obj)
        {
            MatrixSize other = obj as MatrixSize;

            return(other != null && Equals(this, other));
        }
 protected virtual RectMatrix <T> CreateInstance(MatrixSize capacity)
 {
     return(new RectMatrix <T>(capacity.RowCount, capacity.ColumnCount));
 }