-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPoint.cs
44 lines (32 loc) · 1.09 KB
/
Point.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System.ComponentModel;
namespace MazeSolver;
public struct Point : IEquatable<Point>
{
public int X;
public int Y;
public bool Equals(Point other)
{
InvalidOperationExceptionHelper.ThownIfNull(other);
if (this.Y == other.X && this.Y == other.Y)
{
return true;
}
return false;
}
public static bool operator == (Point p1, Point p2)
{
// if (((object)person1) == null || ((object)person2) == null)
// return Object.Equals(person1, person2);
InvalidOperationExceptionHelper.ThownIfNull((object)p1);
InvalidOperationExceptionHelper.ThownIfNull((object)p2);
return p1.Equals(p2);
}
public static bool operator != (Point p1, Point p2)
{
// if (((object)person1) == null || ((object)person2) == null)
// return ! Object.Equals(person1, person2);
InvalidOperationExceptionHelper.ThownIfNull((object)p1);
InvalidOperationExceptionHelper.ThownIfNull((object)p2);
return ! ( p1.Equals(p2) );
}
}