diff --git a/src/SixLabors.Core/Primitives/Point.cs b/src/SixLabors.Core/Primitives/Point.cs
index f302b82182..e42e2bf69d 100644
--- a/src/SixLabors.Core/Primitives/Point.cs
+++ b/src/SixLabors.Core/Primitives/Point.cs
@@ -258,7 +258,10 @@ namespace SixLabors.Primitives
public void Offset(Point point) => this.Offset(point.X, point.Y);
///
- public override int GetHashCode() => this.GetHashCode(this);
+ public override int GetHashCode()
+ {
+ return HashHelpers.Combine(this.X.GetHashCode(), this.Y.GetHashCode());
+ }
///
public override string ToString()
@@ -277,6 +280,5 @@ namespace SixLabors.Primitives
private static short LowInt16(int n) => unchecked((short)(n & 0xffff));
- private int GetHashCode(Point point) => HashHelpers.Combine(point.X.GetHashCode(), point.Y.GetHashCode());
}
}
\ No newline at end of file
diff --git a/src/SixLabors.Core/Primitives/PointF.cs b/src/SixLabors.Core/Primitives/PointF.cs
index 7c04315562..699cec8c69 100644
--- a/src/SixLabors.Core/Primitives/PointF.cs
+++ b/src/SixLabors.Core/Primitives/PointF.cs
@@ -267,7 +267,10 @@ namespace SixLabors.Primitives
public void Offset(PointF point) => this.Offset(point.X, point.Y);
///
- public override int GetHashCode() => this.GetHashCode(this);
+ public override int GetHashCode()
+ {
+ return HashHelpers.Combine(this.X.GetHashCode(), this.Y.GetHashCode());
+ }
///
public override string ToString()
@@ -281,16 +284,5 @@ namespace SixLabors.Primitives
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(PointF other) => this.X.Equals(other.X) && this.Y.Equals(other.Y);
-
- ///
- /// Returns the hash code for this instance.
- ///
- ///
- /// The instance of to return the hash code for.
- ///
- ///
- /// A 32-bit signed integer that is the hash code for this instance.
- ///
- private int GetHashCode(PointF point) => HashHelpers.Combine(point.X.GetHashCode(), point.Y.GetHashCode());
}
}
\ No newline at end of file
diff --git a/src/SixLabors.Core/Primitives/Rectangle.cs b/src/SixLabors.Core/Primitives/Rectangle.cs
index b68732c40c..5b4ac10a7d 100644
--- a/src/SixLabors.Core/Primitives/Rectangle.cs
+++ b/src/SixLabors.Core/Primitives/Rectangle.cs
@@ -443,7 +443,14 @@ namespace SixLabors.Primitives
}
///
- public override int GetHashCode() => this.GetHashCode(this);
+ public override int GetHashCode()
+ {
+ return HashHelpers.Combine(
+ this.X.GetHashCode(),
+ this.Y.GetHashCode(),
+ this.Width.GetHashCode(),
+ this.Height.GetHashCode());
+ }
///
public override string ToString()
@@ -457,15 +464,5 @@ namespace SixLabors.Primitives
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Rectangle other) => this.X == other.X && this.Y == other.Y && this.Width == other.Width && this.Height == other.Height;
-
- private int GetHashCode(Rectangle rectangle)
- {
- return HashHelpers.Combine(
- rectangle.X.GetHashCode(),
- rectangle.Y.GetHashCode(),
- rectangle.Width.GetHashCode(),
- rectangle.Height.GetHashCode()
- );
- }
}
}
\ No newline at end of file
diff --git a/src/SixLabors.Core/Primitives/RectangleF.cs b/src/SixLabors.Core/Primitives/RectangleF.cs
index a33d227e06..a7f46db0a7 100644
--- a/src/SixLabors.Core/Primitives/RectangleF.cs
+++ b/src/SixLabors.Core/Primitives/RectangleF.cs
@@ -120,10 +120,7 @@ namespace SixLabors.Primitives
public float Top
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return this.Y;
- }
+ get => this.Y;
}
///
@@ -132,10 +129,7 @@ namespace SixLabors.Primitives
public float Right
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return this.X + this.Width;
- }
+ get => this.X + this.Width;
}
///
@@ -144,10 +138,7 @@ namespace SixLabors.Primitives
public float Bottom
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return this.Y + this.Height;
- }
+ get => this.Y + this.Height;
}
///
@@ -156,10 +147,7 @@ namespace SixLabors.Primitives
public float Left
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return this.X;
- }
+ get => this.X;
}
///
@@ -376,7 +364,14 @@ namespace SixLabors.Primitives
}
///
- public override int GetHashCode() => this.GetHashCode(this);
+ public override int GetHashCode()
+ {
+ return HashHelpers.Combine(
+ this.X.GetHashCode(),
+ this.Y.GetHashCode(),
+ this.Width.GetHashCode(),
+ this.Height.GetHashCode());
+ }
///
public override string ToString()
@@ -385,20 +380,10 @@ namespace SixLabors.Primitives
}
///
- public override bool Equals(object obj) => obj is RectangleF && this.Equals((RectangleF)obj);
+ public override bool Equals(object obj) => obj is RectangleF other && this.Equals(other);
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(RectangleF other) => this.X.Equals(other.X) && this.Y.Equals(other.Y) && this.Width.Equals(other.Width) && this.Height.Equals(other.Height);
-
- private int GetHashCode(RectangleF rectangle)
- {
- return HashHelpers.Combine(
- rectangle.X.GetHashCode(),
- rectangle.Y.GetHashCode(),
- rectangle.Width.GetHashCode(),
- rectangle.Height.GetHashCode()
- );
- }
}
}
\ No newline at end of file
diff --git a/src/SixLabors.Core/Primitives/SizeF.cs b/src/SixLabors.Core/Primitives/SizeF.cs
index 13c6552ac3..365efdc2aa 100644
--- a/src/SixLabors.Core/Primitives/SizeF.cs
+++ b/src/SixLabors.Core/Primitives/SizeF.cs
@@ -200,7 +200,7 @@ namespace SixLabors.Primitives
///
public override int GetHashCode()
{
- return this.GetHashCode(this);
+ return HashHelpers.Combine(this.Width.GetHashCode(), this.Height.GetHashCode());
}
///
@@ -224,7 +224,5 @@ namespace SixLabors.Primitives
/// Product of type SizeF.
private static SizeF Multiply(SizeF size, float multiplier) =>
new SizeF(size.Width * multiplier, size.Height * multiplier);
-
- private int GetHashCode(SizeF size) => HashHelpers.Combine(size.Width.GetHashCode(), size.Height.GetHashCode());
}
}
\ No newline at end of file