aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/Rectangle.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-03-21 07:39:28 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-04-14 12:44:46 +0200
commit0490aefbd71436f575187602355cfcda48a92063 (patch)
tree63e31069e1aa3faf9cbca41ada94b7efbef1a7fa /src/Rectangle.cs
parent45fb721a432caec62068994ee9a56a4b843bcc03 (diff)
code clean
Diffstat (limited to 'src/Rectangle.cs')
-rw-r--r--src/Rectangle.cs20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/Rectangle.cs b/src/Rectangle.cs
index ce1ed39c..e9445224 100644
--- a/src/Rectangle.cs
+++ b/src/Rectangle.cs
@@ -247,6 +247,24 @@ namespace Crow
int.Parse(d[2]),
int.Parse(d[3]));
}
+ public override int GetHashCode ()
+ {
+ unchecked // Overflow is fine, just wrap
+ {
+ int hash = 17;
+ // Suitable nullity checks etc, of course :)
+ hash = hash * 23 + _x.GetHashCode();
+ hash = hash * 23 + _y.GetHashCode();
+ hash = hash * 23 + _width.GetHashCode();
+ hash = hash * 23 + _height.GetHashCode();
+ return hash;
+ }
+ }
+ public override bool Equals (object obj)
+ {
+ return (obj == null || obj.GetType() != typeof(Rectangle)) ?
+ false :
+ this == (Rectangle)obj;
+ }
}
-
}