这是违反Law of Demeter的?这是否违反了德米特法?
private void MoveEmptyCells()
{
IEnumerable<Cell> cells = this.internalGrid.GetAllEmptyCells();
foreach(Cell cell in cells)
{
cell.RowIndex += this.moveDistance; // violation here?
}
}
这个怎么样?
private void MoveEmptyCell()
{
Cell cell = this.internalGrid.GetEmptyCell();
cell.RowIndex += this.moveDistance; // violation here?
}