public override bool Equals(object obj) { var p = obj as Position; if (p != null) { return (X == p.X && Y == p.Y); } return false; }