private void InitializeCells(IFieldCellFactory cellCreator) { if (cellCreator == null) { throw new ArgumentNullException("Class table cant correctly initialize with a null reference for a cellCreator"); } FieldCell[,] cells = new FieldCell[cellCreator.RowCount, cellCreator.ColCount]; for (int i = 0; i < cellCreator.RowCount; i++) { for (int j = 0; j < cellCreator.ColCount; j++) { cells[i, j] = cellCreator.GenerateNextCell(); } } this.Cells = cells; }
public Table(IFieldCellFactory cellCreator, IFrame frame) { this.InitializeCells(cellCreator); this.Frame = frame; }