這是違反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?
}