Files
minesweeper-coop/CoopSweeper/View/Position.cs
2018-12-16 11:47:26 +01:00

40 lines
1006 B
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace CoopSweeper.View
{
public struct Position
{
public Position(int x, int y)
{
X = x;
Y = y;
}
public int X { get; set; }
public int Y { get; set; }
public override bool Equals(object obj)
{
if (!(obj is Position))
return false;
var position = (Position)obj;
return X == position.X &&
Y == position.Y;
}
public override int GetHashCode()
{
var hashCode = 1861411795;
hashCode = hashCode * -1521134295 + X.GetHashCode();
hashCode = hashCode * -1521134295 + Y.GetHashCode();
return hashCode;
}
public static bool operator ==(Position a, Position b) => a.X == b.X && a.Y == b.Y;
public static bool operator !=(Position a, Position b) => a.X != b.X || a.Y != b.Y;
}
}