diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-03-21 07:39:28 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-04-14 12:44:46 +0200 |
| commit | 0490aefbd71436f575187602355cfcda48a92063 (patch) | |
| tree | 63e31069e1aa3faf9cbca41ada94b7efbef1a7fa /src/Rectangle.cs | |
| parent | 45fb721a432caec62068994ee9a56a4b843bcc03 (diff) | |
code clean
Diffstat (limited to 'src/Rectangle.cs')
| -rw-r--r-- | src/Rectangle.cs | 20 |
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; + } } - } |