I haven't used C # after a while, so I can't give you a specific C # answer. However, I would BorderCell be a subclass of BoardCell (or have a common subclass). As you stated, the structure of your data board will then be a two-dimensional array of type BoardCell. When creating a panel instance, create an instance of the internal cells for the regular BoardCells and BorderCells borders.
If it seems to you that you may need to iterate over borders, etc., define an iterator in the Board class for each type of loop (for example, for corners, upper border, lower border, etc.) using the yield operator.
As for your public void SetSomethingForTheCell(...) instead, I would provide attribute / properties for the cell elements. For example:
BoardCell cell = board.getCell(i,j); cell.setSomething(data)
Il-bhima
source share