public override bool Equals(object obj) { //Check for null and compare run-time types. if ((obj == null) || !this.GetType().Equals(obj.GetType())) { return(false); } else { CellIndex oOther = (CellIndex)obj; return((m_nRow == oOther.m_nRow) && (m_nColumn == oOther.m_nColumn)); } }
public BoardElement GetBoardElementByCellIndex(CellIndex oCellIndex) { if (oCellIndex.m_nColumn < m_oBoardElementArray.GetLowerBound(0)) { return(m_oBoardElement_OutOfBounds); } if (oCellIndex.m_nColumn > m_oBoardElementArray.GetUpperBound(0)) { return(m_oBoardElement_OutOfBounds); } if (oCellIndex.m_nRow < m_oBoardElementArray.GetLowerBound(1)) { return(m_oBoardElement_OutOfBounds); } if (oCellIndex.m_nRow > m_oBoardElementArray.GetUpperBound(1)) { return(m_oBoardElement_OutOfBounds); } return(m_oBoardElementArray[oCellIndex.m_nColumn, oCellIndex.m_nRow]); }