using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 贪吃蛇 { struct Position { public int x; public int y; public Position(int x, int y) { this.x = x; this.y = y; } //重载==和!=运算符来判断两个Position是否相等 public static bool operator == (Position p1, Position p2) { return p1.x == p2.x && p1.y == p2.y; } public static bool operator !=(Position p1, Position p2) { return !(p1 == p2); } } }