aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/Size.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/Size.cs
parent45fb721a432caec62068994ee9a56a4b843bcc03 (diff)
code clean
Diffstat (limited to 'src/Size.cs')
-rw-r--r--src/Size.cs19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/Size.cs b/src/Size.cs
index c9d4427b..21ddb539 100644
--- a/src/Size.cs
+++ b/src/Size.cs
@@ -129,7 +129,24 @@ namespace Crow
return new Size(s.Width + i, s.Height + i);
}
#endregion
-
+
+ public override int GetHashCode ()
+ {
+ unchecked // Overflow is fine, just wrap
+ {
+ int hash = 17;
+ // Suitable nullity checks etc, of course :)
+ hash = hash * 23 + _width.GetHashCode();
+ hash = hash * 23 + _height.GetHashCode();
+ return hash;
+ }
+ }
+ public override bool Equals (object obj)
+ {
+ return (obj == null || obj.GetType() != typeof(Size)) ?
+ false :
+ this == (Size)obj;
+ }
public override string ToString()
{
return string.Format("{0},{1}", Width, Height);