/// <summary> /// Удаляет сущность. /// </summary> /// <param name="key">Ключ, идентифицирующий значение.</param> /// <returns>True если удалено.</returns> public bool Remove(int x, int y) { GridObject tmp = new GridObject(); tmp.SetCoordinate(x, y); foreach (GridObject cur in this.objectTable.Keys) { if (tmp.Equals(cur as object)) { return(objectTable.Remove(cur)); } } return(false); }
public bool ContainsKey(int x, int y) { using (GridObject tmp = new GridObject()) { tmp.SetCoordinate(x, y); foreach (GridObject cur in this.objectTable.Keys) { if (tmp.Equals(cur as object)) { return(true); } } return(false); } }
/// <summary> /// получает значение в (x,y). /// </summary> /// <param name="index">Координаты.</param> /// <returns>Значение.</returns> public GridObject this[int x, int y] { get { using (GridObject tmp = new GridObject()) { tmp.SetCoordinate(x, y); foreach (GridObject cur in this.objectTable.Keys) { if (tmp.Equals(cur as object)) { return(objectTable[cur]); } } return(null); } } }